<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE TypeApplications #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE NamedFieldPuns #-}</span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# LANGUAGE GeneralizedNewtypeDeriving #-}</span><span>
</span><span id="line-5"></span><span class="hs-pragma">{-# LANGUAGE ApplicativeDo #-}</span><span>
</span><span id="line-6"></span><span class="hs-pragma">{-# LANGUAGE DeriveFunctor #-}</span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE FlexibleInstances #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE ViewPatterns #-}</span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# LANGUAGE DerivingVia #-}</span><span>
</span><span id="line-11"></span><span>
</span><span id="line-12"></span><span class="hs-comment">{- | This module implements 'addHaddockToModule', which inserts Haddock
    comments accumulated during parsing into the AST (#17544).

We process Haddock comments in two phases:

1. Parse the program (via the Happy parser in `Parser.y`), generating
   an AST, and (quite separately) a list of all the Haddock comments
   found in the file. More precisely, the Haddock comments are
   accumulated in the `hdk_comments` field of the `PState`, the parser
   state (see Lexer.x):

     data PState = PState { ...
                          ,  hdk_comments :: [PsLocated HdkComment] }

   Each of these Haddock comments has a `PsSpan`, which gives the `BufPos` of
   the beginning and end of the Haddock comment.

2. Walk over the AST, attaching the Haddock comments to the correct
   parts of the tree. This step is called `addHaddockToModule`, and is
   implemented in this module.

   See Note [Adding Haddock comments to the syntax tree].

This approach codifies an important principle:

  The presence or absence of a Haddock comment should never change the parsing
  of a program.

Alternative approaches that did not work properly:

1. Using 'RealSrcLoc' instead of 'BufPos'. This led to failures in presence
   of {-# LANGUAGE CPP #-} and other sources of line pragmas. See documentation
   on 'BufPos' (in GHC.Types.SrcLoc) for the details.

2. In earlier versions of GHC, the Haddock comments were incorporated into the
   Parser.y grammar. The parser constructed the AST and attached comments to it in
   a single pass. See Note [Old solution: Haddock in the grammar] for the details.
-}</span><span>
</span><span id="line-50"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Parser.PostProcess.Haddock</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockToModule"><span class="hs-identifier">addHaddockToModule</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Real.html#mod"><span class="hs-identifier">mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Driver.Flags.html#WarningFlag"><span class="hs-identifier">WarningFlag</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator">(&lt;&gt;)</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html"><span class="hs-identifier">GHC.Data.Bag</span></a></span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Semigroup.html#"><span class="hs-identifier">Data.Semigroup</span></a></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#"><span class="hs-identifier">Data.Foldable</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Traversable.html#"><span class="hs-identifier">Data.Traversable</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.State.Strict.html#"><span class="hs-identifier">Control.Monad.Trans.State.Strict</span></a></span><span>
</span><span id="line-66"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.Reader.html#"><span class="hs-identifier">Control.Monad.Trans.Reader</span></a></span><span>
</span><span id="line-67"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.Writer.html#"><span class="hs-identifier">Control.Monad.Trans.Writer</span></a></span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#"><span class="hs-identifier">Data.Functor.Identity</span></a></span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Coerce.html#"><span class="hs-identifier">Data.Coerce</span></a></span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.Monoid.html#"><span class="hs-identifier">Data.Monoid</span></a></span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html"><span class="hs-identifier">GHC.Parser.Lexer</span></a></span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Misc.html#mergeListsBy"><span class="hs-identifier">mergeListsBy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#filterOut"><span class="hs-identifier">filterOut</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#mapLastM"><span class="hs-identifier">mapLastM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#%3C%26%26%3E"><span class="hs-operator">(&lt;&amp;&amp;&gt;)</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span class="hs-comment">{- Note [Adding Haddock comments to the syntax tree]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'addHaddock' traverses the AST in concrete syntax order, building a computation
(represented by HdkA) that reconstructs the AST but with Haddock comments
inserted in appropriate positions:

  addHaddock :: HasHaddock a =&gt; a -&gt; HdkA a

Consider this code example:

  f :: Int  -- ^ comment on argument
    -&gt; Bool -- ^ comment on result

In the AST, the &quot;Int&quot; part of this snippet is represented like this
(pseudo-code):

  L (BufSpan 6 8) (HsTyVar &quot;Int&quot;) :: LHsType GhcPs

And the comments are represented like this (pseudo-code):

  L (BufSpan 11 35) (HdkCommentPrev &quot;comment on argument&quot;)
  L (BufSpan 46 69) (HdkCommentPrev &quot;comment on result&quot;)

So when we are traversing the AST and 'addHaddock' is applied to HsTyVar &quot;Int&quot;,
how does it know to associate it with &quot;comment on argument&quot; but not with
&quot;comment on result&quot;?

The trick is to look in the space between syntactic elements. In the example above,
the location range in which we search for HdkCommentPrev is as follows:

  f :: Int&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;
   &#9608;&#9608;&#9608;&#9608;Bool -- ^ comment on result

We search for comments after  HsTyVar &quot;Int&quot;  and until the next syntactic
element, in this case  HsTyVar &quot;Bool&quot;.

Ignoring the &quot;-&gt;&quot; allows us to accomodate alternative coding styles:

  f :: Int -&gt;   -- ^ comment on argument
       Bool     -- ^ comment on result

Sometimes we also need to take indentation information into account.
Compare the following examples:

    class C a where
      f :: a -&gt; Int
      -- ^ comment on f

    class C a where
      f :: a -&gt; Int
    -- ^ comment on C

Notice how &quot;comment on f&quot; and &quot;comment on C&quot; differ only by indentation level.

Therefore, in order to know the location range in which the comments are applicable
to a syntactic elements, we need three nuggets of information:
  1. lower bound on the BufPos of a comment
  2. upper bound on the BufPos of a comment
  3. minimum indentation level of a comment

This information is represented by the 'LocRange' type.

In order to propagate this information, we have the 'HdkA' applicative.
'HdkA' is defined as follows:

  data HdkA a = HdkA (Maybe BufSpan) (HdkM a)

The first field contains a 'BufSpan', which represents the location
span taken by a syntactic element:

  addHaddock (L bufSpan ...) = HdkA (Just bufSpan) ...

The second field, 'HdkM', is a stateful computation that looks up Haddock
comments in the specified location range:

  HdkM a &#8776;
       LocRange                  -- The allowed location range
    -&gt; [PsLocated HdkComment]    -- Unallocated comments
    -&gt; (a,                       -- AST with comments inserted into it
        [PsLocated HdkComment])  -- Leftover comments

The 'Applicative' instance for 'HdkA' is defined in such a way that the
location range of every computation is defined by its neighbours:

  addHaddock aaa &lt;*&gt; addHaddock bbb &lt;*&gt; addHaddock ccc

Here, the 'LocRange' passed to the 'HdkM' computation of  addHaddock bbb
is determined by the BufSpan recorded in  addHaddock aaa  and  addHaddock ccc.

This is why it's important to traverse the AST in the order of the concrete
syntax. In the example above we assume that  aaa, bbb, ccc  are ordered by location:

  * getBufSpan (getLoc aaa) &lt; getBufSpan (getLoc bbb)
  * getBufSpan (getLoc bbb) &lt; getBufSpan (getLoc ccc)

Violation of this assumption would lead to bugs, and care must be taken to
traverse the AST correctly. For example, when dealing with class declarations,
we have to use 'flattenBindsAndSigs' to traverse it in the correct order.
-}</span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span class="hs-comment">-- | Add Haddock documentation accumulated in the parser state</span><span>
</span><span id="line-176"></span><span class="hs-comment">-- to a parsed HsModule.</span><span>
</span><span id="line-177"></span><span class="hs-comment">--</span><span>
</span><span id="line-178"></span><span class="hs-comment">-- Reports badly positioned comments when -Winvalid-haddock is enabled.</span><span>
</span><span id="line-179"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockToModule"><span class="hs-identifier hs-type">addHaddockToModule</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.html#HsModule"><span class="hs-identifier hs-type">HsModule</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#P"><span class="hs-identifier hs-type">P</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.html#HsModule"><span class="hs-identifier hs-type">HsModule</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-180"></span><span id="addHaddockToModule"><span class="annot"><span class="annottext">addHaddockToModule :: Located HsModule -&gt; P (Located HsModule)
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockToModule"><span class="hs-identifier hs-var hs-var">addHaddockToModule</span></a></span></span><span> </span><span id="local-6989586621680974222"><span class="annot"><span class="annottext">Located HsModule
</span><a href="#local-6989586621680974222"><span class="hs-identifier hs-var">lmod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-181"></span><span>  </span><span id="local-6989586621680974221"><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680974221"><span class="hs-identifier hs-var">pState</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">P PState
</span><a href="GHC.Parser.Lexer.html#getPState"><span class="hs-identifier hs-var">getPState</span></a></span><span>
</span><span id="line-182"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680974219"><span class="annot"><span class="annottext">all_comments :: [PsLocated HdkComment]
</span><a href="#local-6989586621680974219"><span class="hs-identifier hs-var hs-var">all_comments</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OrdList (PsLocated HdkComment) -&gt; [PsLocated HdkComment]
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#toList"><span class="hs-identifier hs-var">toList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PState -&gt; OrdList (PsLocated HdkComment)
</span><a href="GHC.Parser.Lexer.html#hdk_comments"><span class="hs-identifier hs-var hs-var">hdk_comments</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680974221"><span class="hs-identifier hs-var">pState</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-183"></span><span>      </span><span id="local-6989586621680974216"><span class="annot"><span class="annottext">initial_hdk_st :: HdkSt
</span><a href="#local-6989586621680974216"><span class="hs-identifier hs-var hs-var">initial_hdk_st</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment] -&gt; [HdkWarn] -&gt; HdkSt
</span><a href="GHC.Parser.PostProcess.Haddock.html#HdkSt"><span class="hs-identifier hs-var">HdkSt</span></a></span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680974219"><span class="hs-identifier hs-var">all_comments</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-184"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621680974214"><span class="annot"><span class="annottext">Located HsModule
</span><a href="#local-6989586621680974214"><span class="hs-identifier hs-var">lmod'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680974213"><span class="annot"><span class="annottext">HdkSt
</span><a href="#local-6989586621680974213"><span class="hs-identifier hs-var">final_hdk_st</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HdkA (Located HsModule) -&gt; HdkSt -&gt; (Located HsModule, HdkSt)
forall a. HdkA a -&gt; HdkSt -&gt; (a, HdkSt)
</span><a href="GHC.Parser.PostProcess.Haddock.html#runHdkA"><span class="hs-identifier hs-var">runHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located HsModule -&gt; HdkA (Located HsModule)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">Located HsModule
</span><a href="#local-6989586621680974222"><span class="hs-identifier hs-var">lmod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HdkSt
</span><a href="#local-6989586621680974216"><span class="hs-identifier hs-var">initial_hdk_st</span></a></span><span>
</span><span id="line-185"></span><span>      </span><span id="local-6989586621680974210"><span class="annot"><span class="annottext">hdk_warnings :: [HdkWarn]
</span><a href="#local-6989586621680974210"><span class="hs-identifier hs-var hs-var">hdk_warnings</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HdkSt -&gt; [HdkWarn]
</span><a href="GHC.Parser.PostProcess.Haddock.html#collectHdkWarnings"><span class="hs-identifier hs-var">collectHdkWarnings</span></a></span><span> </span><span class="annot"><span class="annottext">HdkSt
</span><a href="#local-6989586621680974213"><span class="hs-identifier hs-var">final_hdk_st</span></a></span><span>
</span><span id="line-186"></span><span>        </span><span class="hs-comment">-- lmod':        module with Haddock comments inserted into the AST</span><span>
</span><span id="line-187"></span><span>        </span><span class="hs-comment">-- hdk_warnings: warnings accumulated during AST/comment processing</span><span>
</span><span id="line-188"></span><span>  </span><span class="annot"><span class="annottext">(HdkWarn -&gt; P ()) -&gt; [HdkWarn] -&gt; P ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">HdkWarn -&gt; P ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#reportHdkWarning"><span class="hs-identifier hs-var">reportHdkWarning</span></a></span><span> </span><span class="annot"><span class="annottext">[HdkWarn]
</span><a href="#local-6989586621680974210"><span class="hs-identifier hs-var">hdk_warnings</span></a></span><span>
</span><span id="line-189"></span><span>  </span><span class="hs-identifier">return</span><span> </span><span class="annot"><span class="annottext">Located HsModule
</span><a href="#local-6989586621680974214"><span class="hs-identifier hs-var">lmod'</span></a></span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#reportHdkWarning"><span class="hs-identifier hs-type">reportHdkWarning</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkWarn"><span class="hs-identifier hs-type">HdkWarn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#P"><span class="hs-identifier hs-type">P</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-192"></span><span id="reportHdkWarning"><span class="annot"><span class="annottext">reportHdkWarning :: HdkWarn -&gt; P ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#reportHdkWarning"><span class="hs-identifier hs-var hs-var">reportHdkWarning</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkWarnInvalidComment"><span class="hs-identifier hs-type">HdkWarnInvalidComment</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680974204"><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680974204"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="annottext">HdkComment
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-193"></span><span>  </span><span class="annot"><span class="annottext">WarningFlag -&gt; SrcSpan -&gt; SDoc -&gt; P ()
forall (m :: * -&gt; *).
MonadP m =&gt;
WarningFlag -&gt; SrcSpan -&gt; SDoc -&gt; m ()
</span><a href="GHC.Parser.Lexer.html#addWarning"><span class="hs-identifier hs-var">addWarning</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnInvalidHaddock"><span class="hs-identifier hs-var">Opt_WarnInvalidHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PsSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#mkSrcSpanPs"><span class="hs-identifier hs-var">mkSrcSpanPs</span></a></span><span> </span><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680974204"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; P ()) -&gt; SDoc -&gt; P ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-194"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;A Haddock comment cannot appear in this position and will be ignored.&quot;</span></span><span>
</span><span id="line-195"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#reportHdkWarning"><span class="hs-identifier hs-var">reportHdkWarning</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkWarnExtraComment"><span class="hs-identifier hs-type">HdkWarnExtraComment</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680974198"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680974198"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="annottext">HsDocString
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-196"></span><span>  </span><span class="annot"><span class="annottext">WarningFlag -&gt; SrcSpan -&gt; SDoc -&gt; P ()
forall (m :: * -&gt; *).
MonadP m =&gt;
WarningFlag -&gt; SrcSpan -&gt; SDoc -&gt; m ()
</span><a href="GHC.Parser.Lexer.html#addWarning"><span class="hs-identifier hs-var">addWarning</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnInvalidHaddock"><span class="hs-identifier hs-var">Opt_WarnInvalidHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680974198"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; P ()) -&gt; SDoc -&gt; P ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-197"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Multiple Haddock comments for a single entity are not allowed.&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-198"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;The extraneous comment will be ignored.&quot;</span></span><span>
</span><span id="line-199"></span><span>
</span><span id="line-200"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#collectHdkWarnings"><span class="hs-identifier hs-type">collectHdkWarnings</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkSt"><span class="hs-identifier hs-type">HdkSt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkWarn"><span class="hs-identifier hs-type">HdkWarn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-201"></span><span id="collectHdkWarnings"><span class="annot"><span class="annottext">collectHdkWarnings :: HdkSt -&gt; [HdkWarn]
</span><a href="GHC.Parser.PostProcess.Haddock.html#collectHdkWarnings"><span class="hs-identifier hs-var hs-var">collectHdkWarnings</span></a></span></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkSt"><span class="hs-identifier hs-type">HdkSt</span></a></span><span class="hs-special">{</span><span> </span><span id="local-6989586621680974196"><span class="annot"><span class="annottext">[PsLocated HdkComment]
hdk_st_pending :: HdkSt -&gt; [PsLocated HdkComment]
hdk_st_pending :: [PsLocated HdkComment]
</span><a href="GHC.Parser.PostProcess.Haddock.html#hdk_st_pending"><span class="hs-identifier hs-var hs-var">hdk_st_pending</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680974194"><span class="annot"><span class="annottext">[HdkWarn]
hdk_st_warnings :: HdkSt -&gt; [HdkWarn]
hdk_st_warnings :: [HdkWarn]
</span><a href="GHC.Parser.PostProcess.Haddock.html#hdk_st_warnings"><span class="hs-identifier hs-var hs-var">hdk_st_warnings</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-202"></span><span>  </span><span class="annot"><span class="annottext">(PsLocated HdkComment -&gt; HdkWarn)
-&gt; [PsLocated HdkComment] -&gt; [HdkWarn]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment -&gt; HdkWarn
</span><a href="GHC.Parser.PostProcess.Haddock.html#HdkWarnInvalidComment"><span class="hs-identifier hs-var">HdkWarnInvalidComment</span></a></span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680974196"><span class="hs-identifier hs-var">hdk_st_pending</span></a></span><span> </span><span class="hs-comment">-- leftover Haddock comments not inserted into the AST</span><span>
</span><span id="line-203"></span><span>  </span><span class="annot"><span class="annottext">[HdkWarn] -&gt; [HdkWarn] -&gt; [HdkWarn]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[HdkWarn]
</span><a href="#local-6989586621680974194"><span class="hs-identifier hs-var">hdk_st_warnings</span></a></span><span>
</span><span id="line-204"></span><span>
</span><span id="line-205"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
*       addHaddock: a family of functions that processes the AST       *
*    in concrete syntax order, adding documentation comments to it     *
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span class="hs-comment">-- HasHaddock is a convenience class for overloading the addHaddock operation.</span><span>
</span><span id="line-213"></span><span class="hs-comment">-- Alternatively, we could define a family of monomorphic functions:</span><span>
</span><span id="line-214"></span><span class="hs-comment">--</span><span>
</span><span id="line-215"></span><span class="hs-comment">--    addHaddockSomeTypeX    :: SomeTypeX    -&gt; HdkA SomeTypeX</span><span>
</span><span id="line-216"></span><span class="hs-comment">--    addHaddockAnotherTypeY :: AnotherTypeY -&gt; HdkA AnotherTypeY</span><span>
</span><span id="line-217"></span><span class="hs-comment">--    addHaddockOneMoreTypeZ :: OneMoreTypeZ -&gt; HdkA OneMoreTypeZ</span><span>
</span><span id="line-218"></span><span class="hs-comment">--</span><span>
</span><span id="line-219"></span><span class="hs-comment">-- But having a single name for all of them is just easier to read, and makes it clear</span><span>
</span><span id="line-220"></span><span class="hs-comment">-- that they all are of the form  t -&gt; HdkA t  for some t.</span><span>
</span><span id="line-221"></span><span class="hs-comment">--</span><span>
</span><span id="line-222"></span><span class="hs-comment">-- If you need to handle a more complicated scenario that doesn't fit this</span><span>
</span><span id="line-223"></span><span class="hs-comment">-- pattern, it's always possible to define separate functions outside of this</span><span>
</span><span id="line-224"></span><span class="hs-comment">-- class, as is done in case of e.g. addHaddockConDeclField.</span><span>
</span><span id="line-225"></span><span class="hs-comment">--</span><span>
</span><span id="line-226"></span><span class="hs-comment">-- See Note [Adding Haddock comments to the syntax tree].</span><span>
</span><span id="line-227"></span><span class="hs-keyword">class</span><span> </span><span id="HasHaddock"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-var">HasHaddock</span></a></span></span><span> </span><span id="local-6989586621680974676"><span class="annot"><a href="#local-6989586621680974676"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-228"></span><span>  </span><span id="addHaddock"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-type">addHaddock</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680974676"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974676"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span id="local-6989586621680974657"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974657"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680974657"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-231"></span><span>  </span><span id="local-6989586621680974184"><span class="annot"><span class="annottext">addHaddock :: [a] -&gt; HdkA [a]
</span><a href="#local-6989586621680974184"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; HdkA a) -&gt; [a] -&gt; HdkA [a]
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; HdkA a
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span></span><span>
</span><span id="line-232"></span><span>
</span><span id="line-233"></span><span class="hs-comment">--    -- | Module header comment</span><span>
</span><span id="line-234"></span><span class="hs-comment">--    module M (</span><span>
</span><span id="line-235"></span><span class="hs-comment">--        -- * Export list comment</span><span>
</span><span id="line-236"></span><span class="hs-comment">--        Item1,</span><span>
</span><span id="line-237"></span><span class="hs-comment">--        Item2,</span><span>
</span><span id="line-238"></span><span class="hs-comment">--        -- * Export list comment</span><span>
</span><span id="line-239"></span><span class="hs-comment">--        item3,</span><span>
</span><span id="line-240"></span><span class="hs-comment">--        item4</span><span>
</span><span id="line-241"></span><span class="hs-comment">--      ) where</span><span>
</span><span id="line-242"></span><span class="hs-comment">--</span><span>
</span><span id="line-243"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.html#HsModule"><span class="hs-identifier hs-type">HsModule</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-244"></span><span>  </span><span id="local-6989586621680974161"><span class="annot"><span class="annottext">addHaddock :: Located HsModule -&gt; HdkA (Located HsModule)
</span><a href="#local-6989586621680974161"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680974160"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680974160"><span class="hs-identifier hs-var">l_mod</span></a></span></span><span> </span><span id="local-6989586621680974159"><span class="annot"><span class="annottext">HsModule
</span><a href="#local-6989586621680974159"><span class="hs-identifier hs-var">mod</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-245"></span><span>    </span><span class="hs-comment">-- Step 1, get the module header documentation comment:</span><span>
</span><span id="line-246"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-247"></span><span>    </span><span class="hs-comment">--    -- | Module header comment</span><span>
</span><span id="line-248"></span><span>    </span><span class="hs-comment">--    module M where</span><span>
</span><span id="line-249"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-250"></span><span>    </span><span class="hs-comment">-- Only do this when the module header exists.</span><span>
</span><span id="line-251"></span><span>    </span><span id="local-6989586621680974158"><span class="annot"><span class="annottext">Maybe (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="#local-6989586621680974158"><span class="hs-identifier hs-var">headerDocs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-252"></span><span>      </span><span class="annot"><span class="annottext">forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
t a -&gt; (a -&gt; f b) -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#for"><span class="hs-identifier hs-var">for</span></a></span><span> </span><span class="hs-glyph">@</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsModule -&gt; Maybe (Located ModuleName)
</span><a href="GHC.Hs.html#hsmodName"><span class="hs-identifier hs-var hs-var">hsmodName</span></a></span><span> </span><span class="annot"><span class="annottext">HsModule
</span><a href="#local-6989586621680974159"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((Located ModuleName
  -&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString)))
 -&gt; HdkA (Maybe (Maybe (GenLocated SrcSpan HsDocString))))
-&gt; (Located ModuleName
    -&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString)))
-&gt; HdkA (Maybe (Maybe (GenLocated SrcSpan HsDocString)))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680974155"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680974155"><span class="hs-identifier hs-var">l_name</span></a></span></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-253"></span><span>      </span><span class="annot"><span class="annottext">SrcSpan
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString))
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString))
forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var">extendHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680974155"><span class="hs-identifier hs-var">l_name</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (Maybe (GenLocated SrcSpan HsDocString))
 -&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString)))
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString))
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HdkM (Maybe (GenLocated SrcSpan HsDocString))
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString))
forall a. HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#liftHdkA"><span class="hs-identifier hs-var">liftHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkM (Maybe (GenLocated SrcSpan HsDocString))
 -&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString)))
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-254"></span><span>        </span><span class="hs-comment">-- todo: register keyword location of 'module', see Note [Register keyword location]</span><span>
</span><span id="line-255"></span><span>        </span><span id="local-6989586621680974152"><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680974152"><span class="hs-identifier hs-var">docs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-256"></span><span>          </span><span class="annot"><span class="annottext">LocRange
-&gt; HdkM [GenLocated SrcSpan HsDocString]
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a. LocRange -&gt; HdkM a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#inLocRange"><span class="hs-identifier hs-var">inLocRange</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe BufPos -&gt; LocRange
</span><a href="GHC.Parser.PostProcess.Haddock.html#locRangeTo"><span class="hs-identifier hs-var">locRangeTo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; Maybe BufPos
</span><a href="GHC.Types.SrcLoc.html#getBufPos"><span class="hs-identifier hs-var">getBufPos</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcLoc
</span><a href="GHC.Types.SrcLoc.html#srcSpanStart"><span class="hs-identifier hs-var">srcSpanStart</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680974155"><span class="hs-identifier hs-var">l_name</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(HdkM [GenLocated SrcSpan HsDocString]
 -&gt; HdkM [GenLocated SrcSpan HsDocString])
-&gt; HdkM [GenLocated SrcSpan HsDocString]
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-257"></span><span>          </span><span class="annot"><span class="annottext">(PsLocated HdkComment -&gt; Maybe (GenLocated SrcSpan HsDocString))
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a. (PsLocated HdkComment -&gt; Maybe a) -&gt; HdkM [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#takeHdkComments"><span class="hs-identifier hs-var">takeHdkComments</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment -&gt; Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocNext"><span class="hs-identifier hs-var">mkDocNext</span></a></span><span>
</span><span id="line-258"></span><span>        </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#selectDocString"><span class="hs-identifier hs-var">selectDocString</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680974152"><span class="hs-identifier hs-var">docs</span></a></span><span>
</span><span id="line-259"></span><span>
</span><span id="line-260"></span><span>    </span><span class="hs-comment">-- Step 2, process documentation comments in the export list:</span><span>
</span><span id="line-261"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-262"></span><span>    </span><span class="hs-comment">--  module M (</span><span>
</span><span id="line-263"></span><span>    </span><span class="hs-comment">--        -- * Export list comment</span><span>
</span><span id="line-264"></span><span>    </span><span class="hs-comment">--        Item1,</span><span>
</span><span id="line-265"></span><span>    </span><span class="hs-comment">--        Item2,</span><span>
</span><span id="line-266"></span><span>    </span><span class="hs-comment">--        -- * Export list comment</span><span>
</span><span id="line-267"></span><span>    </span><span class="hs-comment">--        item3,</span><span>
</span><span id="line-268"></span><span>    </span><span class="hs-comment">--        item4</span><span>
</span><span id="line-269"></span><span>    </span><span class="hs-comment">--    ) where</span><span>
</span><span id="line-270"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-271"></span><span>    </span><span class="hs-comment">-- Only do this when the export list exists.</span><span>
</span><span id="line-272"></span><span>    </span><span id="local-6989586621680974144"><span class="annot"><span class="annottext">Maybe (Located [LIE GhcPs])
</span><a href="#local-6989586621680974144"><span class="hs-identifier hs-var">hsmodExports'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="hs-glyph">@</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Located [LIE GhcPs] -&gt; HdkA (Located [LIE GhcPs])
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsModule -&gt; Maybe (Located [LIE GhcPs])
</span><a href="GHC.Hs.html#hsmodExports"><span class="hs-identifier hs-var hs-var">hsmodExports</span></a></span><span> </span><span class="annot"><span class="annottext">HsModule
</span><a href="#local-6989586621680974159"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span>    </span><span class="hs-comment">-- Step 3, register the import section to reject invalid comments:</span><span>
</span><span id="line-275"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-276"></span><span>    </span><span class="hs-comment">--   import Data.Maybe</span><span>
</span><span id="line-277"></span><span>    </span><span class="hs-comment">--   -- | rejected comment (cannot appear here)</span><span>
</span><span id="line-278"></span><span>    </span><span class="hs-comment">--   import Data.Bool</span><span>
</span><span id="line-279"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-280"></span><span>    </span><span class="annot"><span class="annottext">(Located (ImportDecl GhcPs) -&gt; HdkA ())
-&gt; [Located (ImportDecl GhcPs)] -&gt; HdkA ()
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Foldable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f ()
</span><a href="../../base/src/Data.Foldable.html#traverse_"><span class="hs-identifier hs-var">traverse_</span></a></span><span> </span><span class="annot"><span class="annottext">Located (ImportDecl GhcPs) -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsModule -&gt; [Located (ImportDecl GhcPs)]
</span><a href="GHC.Hs.html#hsmodImports"><span class="hs-identifier hs-var hs-var">hsmodImports</span></a></span><span> </span><span class="annot"><span class="annottext">HsModule
</span><a href="#local-6989586621680974159"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-281"></span><span>
</span><span id="line-282"></span><span>    </span><span class="hs-comment">-- Step 4, process declarations:</span><span>
</span><span id="line-283"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-284"></span><span>    </span><span class="hs-comment">--    module M where</span><span>
</span><span id="line-285"></span><span>    </span><span class="hs-comment">--      -- | Comment on D</span><span>
</span><span id="line-286"></span><span>    </span><span class="hs-comment">--      data D = MkD  -- ^ Comment on MkD</span><span>
</span><span id="line-287"></span><span>    </span><span class="hs-comment">--      data C = MkC  -- ^ Comment on MkC</span><span>
</span><span id="line-288"></span><span>    </span><span class="hs-comment">--      -- ^ Comment on C</span><span>
</span><span id="line-289"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-290"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680974139"><span class="annot"><span class="annottext">layout_info :: LayoutInfo
</span><a href="#local-6989586621680974139"><span class="hs-identifier hs-var hs-var">layout_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsModule -&gt; LayoutInfo
</span><a href="GHC.Hs.html#hsmodLayout"><span class="hs-identifier hs-var hs-var">hsmodLayout</span></a></span><span> </span><span class="annot"><span class="annottext">HsModule
</span><a href="#local-6989586621680974159"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-291"></span><span>    </span><span id="local-6989586621680974137"><span class="annot"><span class="annottext">[LHsDecl GhcPs]
</span><a href="#local-6989586621680974137"><span class="hs-identifier hs-var">hsmodDecls'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LayoutInfo
-&gt; (PsLocated HdkComment -&gt; Maybe (LHsDecl GhcPs))
-&gt; [LHsDecl GhcPs]
-&gt; HdkA [LHsDecl GhcPs]
forall a.
HasHaddock a =&gt;
LayoutInfo -&gt; (PsLocated HdkComment -&gt; Maybe a) -&gt; [a] -&gt; HdkA [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockInterleaveItems"><span class="hs-identifier hs-var">addHaddockInterleaveItems</span></a></span><span> </span><span class="annot"><span class="annottext">LayoutInfo
</span><a href="#local-6989586621680974139"><span class="hs-identifier hs-var">layout_info</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LayoutInfo -&gt; PsLocated HdkComment -&gt; Maybe (LHsDecl GhcPs)
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocHsDecl"><span class="hs-identifier hs-var">mkDocHsDecl</span></a></span><span> </span><span class="annot"><span class="annottext">LayoutInfo
</span><a href="#local-6989586621680974139"><span class="hs-identifier hs-var">layout_info</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsModule -&gt; [LHsDecl GhcPs]
</span><a href="GHC.Hs.html#hsmodDecls"><span class="hs-identifier hs-var hs-var">hsmodDecls</span></a></span><span> </span><span class="annot"><span class="annottext">HsModule
</span><a href="#local-6989586621680974159"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-292"></span><span>
</span><span id="line-293"></span><span>    </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HsModule -&gt; Located HsModule
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680974160"><span class="hs-identifier hs-var">l_mod</span></a></span><span> </span><span class="annot"><span class="annottext">(HsModule -&gt; Located HsModule) -&gt; HsModule -&gt; Located HsModule
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-294"></span><span>      </span><span class="annot"><span class="annottext">HsModule
</span><a href="#local-6989586621680974159"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hsmodExports :: Maybe (Located [LIE GhcPs])
</span><a href="GHC.Hs.html#hsmodExports"><span class="hs-identifier hs-var">hsmodExports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Located [LIE GhcPs])
</span><a href="#local-6989586621680974144"><span class="hs-identifier hs-var">hsmodExports'</span></a></span><span>
</span><span id="line-295"></span><span>          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">hsmodDecls :: [LHsDecl GhcPs]
</span><a href="GHC.Hs.html#hsmodDecls"><span class="hs-identifier hs-var">hsmodDecls</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LHsDecl GhcPs]
</span><a href="#local-6989586621680974137"><span class="hs-identifier hs-var">hsmodDecls'</span></a></span><span>
</span><span id="line-296"></span><span>          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">hsmodHaddockModHeader :: Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680974133"><span class="hs-identifier hs-var">hsmodHaddockModHeader</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">forall (m :: * -&gt; *) a. Monad m =&gt; m (m a) -&gt; m a
</span><a href="../../base/src/GHC.Base.html#join"><span class="hs-identifier hs-var">join</span></a></span><span> </span><span class="hs-glyph">@</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="#local-6989586621680974158"><span class="hs-identifier hs-var">headerDocs</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-297"></span><span>
</span><span id="line-298"></span><span class="hs-comment">-- Only for module exports, not module imports.</span><span>
</span><span id="line-299"></span><span class="hs-comment">--</span><span>
</span><span id="line-300"></span><span class="hs-comment">--    module M (a, b, c) where   -- use on this [LIE GhcPs]</span><span>
</span><span id="line-301"></span><span class="hs-comment">--    import I (a, b, c)         -- do not use here!</span><span>
</span><span id="line-302"></span><span class="hs-comment">--</span><span>
</span><span id="line-303"></span><span class="hs-comment">-- Imports cannot have documentation comments anyway.</span><span>
</span><span id="line-304"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIE"><span class="hs-identifier hs-type">LIE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-305"></span><span>  </span><span id="local-6989586621680974127"><span class="annot"><span class="annottext">addHaddock :: Located [LIE GhcPs] -&gt; HdkA (Located [LIE GhcPs])
</span><a href="#local-6989586621680974127"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680974126"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680974126"><span class="hs-identifier hs-var">l_exports</span></a></span></span><span> </span><span id="local-6989586621680974125"><span class="annot"><span class="annottext">[LIE GhcPs]
</span><a href="#local-6989586621680974125"><span class="hs-identifier hs-var">exports</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-306"></span><span>    </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkA (Located [LIE GhcPs]) -&gt; HdkA (Located [LIE GhcPs])
forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var">extendHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680974126"><span class="hs-identifier hs-var">l_exports</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (Located [LIE GhcPs]) -&gt; HdkA (Located [LIE GhcPs]))
-&gt; HdkA (Located [LIE GhcPs]) -&gt; HdkA (Located [LIE GhcPs])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-307"></span><span>      </span><span id="local-6989586621680974124"><span class="annot"><span class="annottext">[LIE GhcPs]
</span><a href="#local-6989586621680974124"><span class="hs-identifier hs-var">exports'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LayoutInfo
-&gt; (PsLocated HdkComment -&gt; Maybe (LIE GhcPs))
-&gt; [LIE GhcPs]
-&gt; HdkA [LIE GhcPs]
forall a.
HasHaddock a =&gt;
LayoutInfo -&gt; (PsLocated HdkComment -&gt; Maybe a) -&gt; [a] -&gt; HdkA [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockInterleaveItems"><span class="hs-identifier hs-var">addHaddockInterleaveItems</span></a></span><span> </span><span class="annot"><span class="annottext">LayoutInfo
</span><a href="GHC.Types.SrcLoc.html#NoLayoutInfo"><span class="hs-identifier hs-var">NoLayoutInfo</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment -&gt; Maybe (LIE GhcPs)
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocIE"><span class="hs-identifier hs-var">mkDocIE</span></a></span><span> </span><span class="annot"><span class="annottext">[LIE GhcPs]
</span><a href="#local-6989586621680974125"><span class="hs-identifier hs-var">exports</span></a></span><span>
</span><span id="line-308"></span><span>      </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerLocHdkA"><span class="hs-identifier hs-var">registerLocHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#srcLocSpan"><span class="hs-identifier hs-var">srcLocSpan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcLoc
</span><a href="GHC.Types.SrcLoc.html#srcSpanEnd"><span class="hs-identifier hs-var">srcSpanEnd</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680974126"><span class="hs-identifier hs-var">l_exports</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Do not consume comments after the closing parenthesis</span><span>
</span><span id="line-309"></span><span>      </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; [LIE GhcPs] -&gt; Located [LIE GhcPs]
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680974126"><span class="hs-identifier hs-var">l_exports</span></a></span><span> </span><span class="annot"><span class="annottext">[LIE GhcPs]
</span><a href="#local-6989586621680974124"><span class="hs-identifier hs-var">exports'</span></a></span><span>
</span><span id="line-310"></span><span>
</span><span id="line-311"></span><span class="hs-comment">-- Needed to use 'addHaddockInterleaveItems' in 'instance HasHaddock (Located [LIE GhcPs])'.</span><span>
</span><span id="line-312"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIE"><span class="hs-identifier hs-type">LIE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-313"></span><span>  </span><span id="local-6989586621680974116"><span class="annot"><span class="annottext">addHaddock :: LIE GhcPs -&gt; HdkA (LIE GhcPs)
</span><a href="#local-6989586621680974116"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span id="local-6989586621680974115"><span class="annot"><span class="annottext">LIE GhcPs
</span><a href="#local-6989586621680974115"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LIE GhcPs
</span><a href="#local-6989586621680974115"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">LIE GhcPs -&gt; HdkA () -&gt; HdkA (LIE GhcPs)
forall (f :: * -&gt; *) a b. Functor f =&gt; a -&gt; f b -&gt; f a
</span><a href="../../base/src/GHC.Base.html#%3C%24"><span class="hs-operator hs-var">&lt;$</span></a></span><span> </span><span class="annot"><span class="annottext">LIE GhcPs -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">LIE GhcPs
</span><a href="#local-6989586621680974115"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-314"></span><span>
</span><span id="line-315"></span><span class="hs-comment">{- Add Haddock items to a list of non-Haddock items.
Used to process export lists (with mkDocIE) and declarations (with mkDocHsDecl).

For example:

  module M where
    -- | Comment on D
    data D = MkD  -- ^ Comment on MkD
    data C = MkC  -- ^ Comment on MkC
    -- ^ Comment on C

In this case, we should produce four HsDecl items (pseudo-code):

  1. DocD (DocCommentNext &quot;Comment on D&quot;)
  2. TyClD (DataDecl &quot;D&quot; ... [ConDeclH98 &quot;MkD&quot; ... (Just &quot;Comment on MkD&quot;)])
  3. TyClD (DataDecl &quot;C&quot; ... [ConDeclH98 &quot;MkC&quot; ... (Just &quot;Comment on MkC&quot;)])
  4. DocD (DocCommentPrev &quot;Comment on C&quot;)

The inputs to addHaddockInterleaveItems are:

  * layout_info :: LayoutInfo

    In the example above, note that the indentation level inside the module is
    2 spaces. It would be represented as layout_info = VirtualBraces 2.

    It is used to delimit the search space for comments when processing
    declarations. Here, we restrict indentation levels to &gt;=(2+1), so that when
    we look up comment on MkC, we get &quot;Comment on MkC&quot; but not &quot;Comment on C&quot;.

  * get_doc_item :: PsLocated HdkComment -&gt; Maybe a

    This is the function used to look up documentation comments.
    In the above example, get_doc_item = mkDocHsDecl layout_info,
    and it will produce the following parts of the output:

      DocD (DocCommentNext &quot;Comment on D&quot;)
      DocD (DocCommentPrev &quot;Comment on C&quot;)

  * The list of items. These are the declarations that will be annotated with
    documentation comments.

    Before processing:
       TyClD (DataDecl &quot;D&quot; ... [ConDeclH98 &quot;MkD&quot; ... Nothing])
       TyClD (DataDecl &quot;C&quot; ... [ConDeclH98 &quot;MkC&quot; ... Nothing])

    After processing:
       TyClD (DataDecl &quot;D&quot; ... [ConDeclH98 &quot;MkD&quot; ... (Just &quot;Comment on MkD&quot;)])
       TyClD (DataDecl &quot;C&quot; ... [ConDeclH98 &quot;MkC&quot; ... (Just &quot;Comment on MkC&quot;)])
-}</span><span>
</span><span id="line-364"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockInterleaveItems"><span class="hs-identifier hs-type">addHaddockInterleaveItems</span></a></span><span>
</span><span id="line-365"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680974631"><span class="annot"><a href="#local-6989586621680974631"><span class="hs-identifier hs-type">a</span></a></span></span><span class="hs-operator">.</span><span>
</span><span id="line-366"></span><span>     </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974631"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-367"></span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#LayoutInfo"><span class="hs-identifier hs-type">LayoutInfo</span></a></span><span>
</span><span id="line-368"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974631"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Get a documentation item</span><span>
</span><span id="line-369"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680974631"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>           </span><span class="hs-comment">-- Unprocessed (non-documentation) items</span><span>
</span><span id="line-370"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680974631"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>      </span><span class="hs-comment">-- Documentation items &amp; processed non-documentation items</span><span>
</span><span id="line-371"></span><span id="addHaddockInterleaveItems"><span class="annot"><span class="annottext">addHaddockInterleaveItems :: forall a.
HasHaddock a =&gt;
LayoutInfo -&gt; (PsLocated HdkComment -&gt; Maybe a) -&gt; [a] -&gt; HdkA [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockInterleaveItems"><span class="hs-identifier hs-var hs-var">addHaddockInterleaveItems</span></a></span></span><span> </span><span id="local-6989586621680974104"><span class="annot"><span class="annottext">LayoutInfo
</span><a href="#local-6989586621680974104"><span class="hs-identifier hs-var">layout_info</span></a></span></span><span> </span><span id="local-6989586621680974103"><span class="annot"><span class="annottext">PsLocated HdkComment -&gt; Maybe a
</span><a href="#local-6989586621680974103"><span class="hs-identifier hs-var">get_doc_item</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; HdkA [a]
</span><a href="#local-6989586621680974102"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-372"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-373"></span><span>    </span><span class="annot"><a href="#local-6989586621680974102"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680974631"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680974631"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-374"></span><span>    </span><span id="local-6989586621680974102"><span class="annot"><span class="annottext">go :: [a] -&gt; HdkA [a]
</span><a href="#local-6989586621680974102"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HdkM [a] -&gt; HdkA [a]
forall a. HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#liftHdkA"><span class="hs-identifier hs-var">liftHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(PsLocated HdkComment -&gt; Maybe a) -&gt; HdkM [a]
forall a. (PsLocated HdkComment -&gt; Maybe a) -&gt; HdkM [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#takeHdkComments"><span class="hs-identifier hs-var">takeHdkComments</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment -&gt; Maybe a
</span><a href="#local-6989586621680974103"><span class="hs-identifier hs-var">get_doc_item</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-375"></span><span>    </span><span class="annot"><a href="#local-6989586621680974102"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680974101"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680974101"><span class="hs-identifier hs-var">item</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680974100"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680974100"><span class="hs-identifier hs-var">items</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-376"></span><span>      </span><span id="local-6989586621680974099"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680974099"><span class="hs-identifier hs-var">docItems</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HdkM [a] -&gt; HdkA [a]
forall a. HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#liftHdkA"><span class="hs-identifier hs-var">liftHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(PsLocated HdkComment -&gt; Maybe a) -&gt; HdkM [a]
forall a. (PsLocated HdkComment -&gt; Maybe a) -&gt; HdkM [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#takeHdkComments"><span class="hs-identifier hs-var">takeHdkComments</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment -&gt; Maybe a
</span><a href="#local-6989586621680974103"><span class="hs-identifier hs-var">get_doc_item</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-377"></span><span>      </span><span id="local-6989586621680974098"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680974098"><span class="hs-identifier hs-var">item'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HdkA a -&gt; HdkA a
</span><a href="#local-6989586621680974097"><span class="hs-identifier hs-var">with_layout_info</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; HdkA a
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680974101"><span class="hs-identifier hs-var">item</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-378"></span><span>      </span><span id="local-6989586621680974096"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680974096"><span class="hs-identifier hs-var">other_items</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; HdkA [a]
</span><a href="#local-6989586621680974102"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680974100"><span class="hs-identifier hs-var">items</span></a></span><span>
</span><span id="line-379"></span><span>      </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680974099"><span class="hs-identifier hs-var">docItems</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680974098"><span class="hs-identifier hs-var">item'</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680974096"><span class="hs-identifier hs-var">other_items</span></a></span><span>
</span><span id="line-380"></span><span>
</span><span id="line-381"></span><span>    </span><span class="annot"><a href="#local-6989586621680974097"><span class="hs-identifier hs-type">with_layout_info</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974631"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974631"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-382"></span><span>    </span><span id="local-6989586621680974097"><span class="annot"><span class="annottext">with_layout_info :: HdkA a -&gt; HdkA a
</span><a href="#local-6989586621680974097"><span class="hs-identifier hs-var hs-var">with_layout_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">LayoutInfo
</span><a href="#local-6989586621680974104"><span class="hs-identifier hs-var">layout_info</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-383"></span><span>      </span><span class="annot"><span class="annottext">LayoutInfo
</span><a href="GHC.Types.SrcLoc.html#NoLayoutInfo"><span class="hs-identifier hs-var">NoLayoutInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HdkA a -&gt; HdkA a
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-384"></span><span>      </span><span class="annot"><span class="annottext">LayoutInfo
</span><a href="GHC.Types.SrcLoc.html#ExplicitBraces"><span class="hs-identifier hs-var">ExplicitBraces</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HdkA a -&gt; HdkA a
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-385"></span><span>      </span><span class="annot"><a href="GHC.Types.SrcLoc.html#VirtualBraces"><span class="hs-identifier hs-type">VirtualBraces</span></a></span><span> </span><span id="local-6989586621680974092"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680974092"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-386"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680974091"><span class="annot"><span class="annottext">loc_range :: LocRange
</span><a href="#local-6989586621680974091"><span class="hs-identifier hs-var hs-var">loc_range</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LocRange
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">loc_range_col :: ColumnBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#loc_range_col"><span class="hs-identifier hs-var">loc_range_col</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ColumnBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#ColumnFrom"><span class="hs-identifier hs-var">ColumnFrom</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680974092"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-387"></span><span>        </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">(HdkM a -&gt; HdkM a) -&gt; HdkA a -&gt; HdkA a
forall a b. (HdkM a -&gt; HdkM b) -&gt; HdkA a -&gt; HdkA b
</span><a href="GHC.Parser.PostProcess.Haddock.html#hoistHdkA"><span class="hs-identifier hs-var">hoistHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocRange -&gt; HdkM a -&gt; HdkM a
forall a. LocRange -&gt; HdkM a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#inLocRange"><span class="hs-identifier hs-var">inLocRange</span></a></span><span> </span><span class="annot"><span class="annottext">LocRange
</span><a href="#local-6989586621680974091"><span class="hs-identifier hs-var">loc_range</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-388"></span><span>
</span><span id="line-389"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#LHsDecl"><span class="hs-identifier hs-type">LHsDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-390"></span><span>  </span><span id="local-6989586621680974080"><span class="annot"><span class="annottext">addHaddock :: LHsDecl GhcPs -&gt; HdkA (LHsDecl GhcPs)
</span><a href="#local-6989586621680974080"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span id="local-6989586621680974079"><span class="annot"><span class="annottext">LHsDecl GhcPs
</span><a href="#local-6989586621680974079"><span class="hs-identifier hs-var">ldecl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-391"></span><span>    </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkA (LHsDecl GhcPs) -&gt; HdkA (LHsDecl GhcPs)
forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var">extendHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsDecl GhcPs -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">LHsDecl GhcPs
</span><a href="#local-6989586621680974079"><span class="hs-identifier hs-var">ldecl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(HdkA (LHsDecl GhcPs) -&gt; HdkA (LHsDecl GhcPs))
-&gt; HdkA (LHsDecl GhcPs) -&gt; HdkA (LHsDecl GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-392"></span><span>    </span><span class="annot"><span class="annottext">forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><span class="annottext">HsDecl GhcPs -&gt; HdkA (HsDecl GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsDecl GhcPs
</span><a href="#local-6989586621680974079"><span class="hs-identifier hs-var">ldecl</span></a></span><span>
</span><span id="line-393"></span><span>
</span><span id="line-394"></span><span class="hs-comment">-- Process documentation comments *inside* a declaration, for example:</span><span>
</span><span id="line-395"></span><span class="hs-comment">--</span><span>
</span><span id="line-396"></span><span class="hs-comment">--    data T = MkT -- ^ Comment on MkT (inside DataDecl)</span><span>
</span><span id="line-397"></span><span class="hs-comment">--    f, g</span><span>
</span><span id="line-398"></span><span class="hs-comment">--      :: Int  -- ^ Comment on Int   (inside TypeSig)</span><span>
</span><span id="line-399"></span><span class="hs-comment">--      -&gt; Bool -- ^ Comment on Bool  (inside TypeSig)</span><span>
</span><span id="line-400"></span><span class="hs-comment">--</span><span>
</span><span id="line-401"></span><span class="hs-comment">-- Comments that relate to the entire declaration are processed elsewhere:</span><span>
</span><span id="line-402"></span><span class="hs-comment">--</span><span>
</span><span id="line-403"></span><span class="hs-comment">--    -- | Comment on T (not processed in this instance)</span><span>
</span><span id="line-404"></span><span class="hs-comment">--    data T = MkT</span><span>
</span><span id="line-405"></span><span class="hs-comment">--</span><span>
</span><span id="line-406"></span><span class="hs-comment">--    -- | Comment on f, g (not processed in this instance)</span><span>
</span><span id="line-407"></span><span class="hs-comment">--    f, g :: Int -&gt; Bool</span><span>
</span><span id="line-408"></span><span class="hs-comment">--    f = ...</span><span>
</span><span id="line-409"></span><span class="hs-comment">--    g = ...</span><span>
</span><span id="line-410"></span><span class="hs-comment">--</span><span>
</span><span id="line-411"></span><span class="hs-comment">-- Such comments are inserted into the syntax tree as DocD declarations</span><span>
</span><span id="line-412"></span><span class="hs-comment">-- by addHaddockInterleaveItems, and then associated with other declarations</span><span>
</span><span id="line-413"></span><span class="hs-comment">-- in GHC.HsToCore.Docs (see DeclDocMap).</span><span>
</span><span id="line-414"></span><span class="hs-comment">--</span><span>
</span><span id="line-415"></span><span class="hs-comment">-- In this instance, we only process comments that relate to parts of the</span><span>
</span><span id="line-416"></span><span class="hs-comment">-- declaration, not to the declaration itself.</span><span>
</span><span id="line-417"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#HsDecl"><span class="hs-identifier hs-type">HsDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-418"></span><span>
</span><span id="line-419"></span><span>  </span><span class="hs-comment">-- Type signatures:</span><span>
</span><span id="line-420"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-421"></span><span>  </span><span class="hs-comment">--    f, g</span><span>
</span><span id="line-422"></span><span>  </span><span class="hs-comment">--      :: Int  -- ^ Comment on Int</span><span>
</span><span id="line-423"></span><span>  </span><span class="hs-comment">--      -&gt; Bool -- ^ Comment on Bool</span><span>
</span><span id="line-424"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-425"></span><span>  </span><span id="local-6989586621680974040"><span class="annot"><span class="annottext">addHaddock :: HsDecl GhcPs -&gt; HdkA (HsDecl GhcPs)
</span><a href="#local-6989586621680974040"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#SigD"><span class="hs-identifier hs-type">SigD</span></a></span><span> </span><span class="annot"><span class="annottext">XSigD GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#TypeSig"><span class="hs-identifier hs-type">TypeSig</span></a></span><span> </span><span class="annot"><span class="annottext">XTypeSig GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680974037"><span class="annot"><span class="annottext">[Located (IdP GhcPs)]
</span><a href="#local-6989586621680974037"><span class="hs-identifier hs-var">names</span></a></span></span><span> </span><span id="local-6989586621680974036"><span class="annot"><span class="annottext">LHsSigWcType GhcPs
</span><a href="#local-6989586621680974036"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-426"></span><span>      </span><span class="annot"><span class="annottext">(Located RdrName -&gt; HdkA ()) -&gt; [Located RdrName] -&gt; HdkA ()
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Foldable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f ()
</span><a href="../../base/src/Data.Foldable.html#traverse_"><span class="hs-identifier hs-var">traverse_</span></a></span><span> </span><span class="annot"><span class="annottext">Located RdrName -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">[Located RdrName]
[Located (IdP GhcPs)]
</span><a href="#local-6989586621680974037"><span class="hs-identifier hs-var">names</span></a></span><span>
</span><span id="line-427"></span><span>      </span><span id="local-6989586621680974035"><span class="annot"><span class="annottext">LHsSigWcType GhcPs
</span><a href="#local-6989586621680974035"><span class="hs-identifier hs-var">t'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsSigWcType GhcPs -&gt; HdkA (LHsSigWcType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigWcType GhcPs
</span><a href="#local-6989586621680974036"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-428"></span><span>      </span><span class="hs-identifier">pure</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XSigD GhcPs -&gt; Sig GhcPs -&gt; HsDecl GhcPs
forall p. XSigD p -&gt; Sig p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#SigD"><span class="hs-identifier hs-var">SigD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XSigD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XTypeSig GhcPs
-&gt; [Located (IdP GhcPs)] -&gt; LHsSigWcType GhcPs -&gt; Sig GhcPs
forall pass.
XTypeSig pass
-&gt; [Located (IdP pass)] -&gt; LHsSigWcType pass -&gt; Sig pass
</span><a href="GHC.Hs.Binds.html#TypeSig"><span class="hs-identifier hs-var">TypeSig</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XTypeSig GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">[Located (IdP GhcPs)]
</span><a href="#local-6989586621680974037"><span class="hs-identifier hs-var">names</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigWcType GhcPs
</span><a href="#local-6989586621680974035"><span class="hs-identifier hs-var">t'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-429"></span><span>
</span><span id="line-430"></span><span>  </span><span class="hs-comment">-- Pattern synonym type signatures:</span><span>
</span><span id="line-431"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-432"></span><span>  </span><span class="hs-comment">--    pattern MyPat</span><span>
</span><span id="line-433"></span><span>  </span><span class="hs-comment">--      :: Bool       -- ^ Comment on Bool</span><span>
</span><span id="line-434"></span><span>  </span><span class="hs-comment">--      -&gt; Maybe Bool -- ^ Comment on Maybe Bool</span><span>
</span><span id="line-435"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-436"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#SigD"><span class="hs-identifier hs-type">SigD</span></a></span><span> </span><span class="annot"><span class="annottext">XSigD GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#PatSynSig"><span class="hs-identifier hs-type">PatSynSig</span></a></span><span> </span><span class="annot"><span class="annottext">XPatSynSig GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680974032"><span class="annot"><span class="annottext">[Located (IdP GhcPs)]
</span><a href="#local-6989586621680974032"><span class="hs-identifier hs-var">names</span></a></span></span><span> </span><span id="local-6989586621680974031"><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680974031"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-437"></span><span>    </span><span class="annot"><span class="annottext">(Located RdrName -&gt; HdkA ()) -&gt; [Located RdrName] -&gt; HdkA ()
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Foldable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f ()
</span><a href="../../base/src/Data.Foldable.html#traverse_"><span class="hs-identifier hs-var">traverse_</span></a></span><span> </span><span class="annot"><span class="annottext">Located RdrName -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">[Located RdrName]
[Located (IdP GhcPs)]
</span><a href="#local-6989586621680974032"><span class="hs-identifier hs-var">names</span></a></span><span>
</span><span id="line-438"></span><span>    </span><span id="local-6989586621680974030"><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680974030"><span class="hs-identifier hs-var">t'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs -&gt; HdkA (LHsSigType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680974031"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-439"></span><span>    </span><span class="hs-identifier">pure</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XSigD GhcPs -&gt; Sig GhcPs -&gt; HsDecl GhcPs
forall p. XSigD p -&gt; Sig p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#SigD"><span class="hs-identifier hs-var">SigD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XSigD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XPatSynSig GhcPs
-&gt; [Located (IdP GhcPs)] -&gt; LHsSigType GhcPs -&gt; Sig GhcPs
forall pass.
XPatSynSig pass
-&gt; [Located (IdP pass)] -&gt; LHsSigType pass -&gt; Sig pass
</span><a href="GHC.Hs.Binds.html#PatSynSig"><span class="hs-identifier hs-var">PatSynSig</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XPatSynSig GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">[Located (IdP GhcPs)]
</span><a href="#local-6989586621680974032"><span class="hs-identifier hs-var">names</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680974030"><span class="hs-identifier hs-var">t'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-440"></span><span>
</span><span id="line-441"></span><span>  </span><span class="hs-comment">-- Class method signatures and default signatures:</span><span>
</span><span id="line-442"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-443"></span><span>  </span><span class="hs-comment">--   class C x where</span><span>
</span><span id="line-444"></span><span>  </span><span class="hs-comment">--      method_of_c</span><span>
</span><span id="line-445"></span><span>  </span><span class="hs-comment">--        :: Maybe x -- ^ Comment on Maybe x</span><span>
</span><span id="line-446"></span><span>  </span><span class="hs-comment">--        -&gt; IO ()   -- ^ Comment on IO ()</span><span>
</span><span id="line-447"></span><span>  </span><span class="hs-comment">--      default method_of_c</span><span>
</span><span id="line-448"></span><span>  </span><span class="hs-comment">--        :: Eq x</span><span>
</span><span id="line-449"></span><span>  </span><span class="hs-comment">--        =&gt; Maybe x -- ^ Comment on Maybe x</span><span>
</span><span id="line-450"></span><span>  </span><span class="hs-comment">--        -&gt; IO ()   -- ^ Comment on IO ()</span><span>
</span><span id="line-451"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-452"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#SigD"><span class="hs-identifier hs-type">SigD</span></a></span><span> </span><span class="annot"><span class="annottext">XSigD GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#ClassOpSig"><span class="hs-identifier hs-type">ClassOpSig</span></a></span><span> </span><span class="annot"><span class="annottext">XClassOpSig GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680974028"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680974028"><span class="hs-identifier hs-var">is_dflt</span></a></span></span><span> </span><span id="local-6989586621680974027"><span class="annot"><span class="annottext">[Located (IdP GhcPs)]
</span><a href="#local-6989586621680974027"><span class="hs-identifier hs-var">names</span></a></span></span><span> </span><span id="local-6989586621680974026"><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680974026"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-453"></span><span>    </span><span class="annot"><span class="annottext">(Located RdrName -&gt; HdkA ()) -&gt; [Located RdrName] -&gt; HdkA ()
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Foldable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f ()
</span><a href="../../base/src/Data.Foldable.html#traverse_"><span class="hs-identifier hs-var">traverse_</span></a></span><span> </span><span class="annot"><span class="annottext">Located RdrName -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">[Located RdrName]
[Located (IdP GhcPs)]
</span><a href="#local-6989586621680974027"><span class="hs-identifier hs-var">names</span></a></span><span>
</span><span id="line-454"></span><span>    </span><span id="local-6989586621680974025"><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680974025"><span class="hs-identifier hs-var">t'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs -&gt; HdkA (LHsSigType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680974026"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-455"></span><span>    </span><span class="hs-identifier">pure</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XSigD GhcPs -&gt; Sig GhcPs -&gt; HsDecl GhcPs
forall p. XSigD p -&gt; Sig p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#SigD"><span class="hs-identifier hs-var">SigD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XSigD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XClassOpSig GhcPs
-&gt; Bool -&gt; [Located (IdP GhcPs)] -&gt; LHsSigType GhcPs -&gt; Sig GhcPs
forall pass.
XClassOpSig pass
-&gt; Bool -&gt; [Located (IdP pass)] -&gt; LHsSigType pass -&gt; Sig pass
</span><a href="GHC.Hs.Binds.html#ClassOpSig"><span class="hs-identifier hs-var">ClassOpSig</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XClassOpSig GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680974028"><span class="hs-identifier hs-var">is_dflt</span></a></span><span> </span><span class="annot"><span class="annottext">[Located (IdP GhcPs)]
</span><a href="#local-6989586621680974027"><span class="hs-identifier hs-var">names</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680974025"><span class="hs-identifier hs-var">t'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-456"></span><span>
</span><span id="line-457"></span><span>  </span><span class="hs-comment">-- Data/newtype declarations:</span><span>
</span><span id="line-458"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-459"></span><span>  </span><span class="hs-comment">--   data T = MkT -- ^ Comment on MkT</span><span>
</span><span id="line-460"></span><span>  </span><span class="hs-comment">--            A   -- ^ Comment on A</span><span>
</span><span id="line-461"></span><span>  </span><span class="hs-comment">--            B   -- ^ Comment on B</span><span>
</span><span id="line-462"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-463"></span><span>  </span><span class="hs-comment">--   data G where</span><span>
</span><span id="line-464"></span><span>  </span><span class="hs-comment">--     -- | Comment on MkG</span><span>
</span><span id="line-465"></span><span>  </span><span class="hs-comment">--     MkG :: A    -- ^ Comment on A</span><span>
</span><span id="line-466"></span><span>  </span><span class="hs-comment">--         -&gt; B    -- ^ Comment on B</span><span>
</span><span id="line-467"></span><span>  </span><span class="hs-comment">--         -&gt; G</span><span>
</span><span id="line-468"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-469"></span><span>  </span><span class="hs-comment">--   newtype N = MkN { getN :: Natural }  -- ^ Comment on N</span><span>
</span><span id="line-470"></span><span>  </span><span class="hs-comment">--     deriving newtype (Eq  {- ^ Comment on Eq  N -})</span><span>
</span><span id="line-471"></span><span>  </span><span class="hs-comment">--     deriving newtype (Ord {- ^ Comment on Ord N -})</span><span>
</span><span id="line-472"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-473"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#TyClD"><span class="hs-identifier hs-type">TyClD</span></a></span><span> </span><span class="annot"><span class="annottext">XTyClD GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680974023"><span class="annot"><span class="annottext">TyClDecl GhcPs
</span><a href="#local-6989586621680974023"><span class="hs-identifier hs-var">decl</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-474"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#DataDecl"><span class="hs-identifier hs-type">DataDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680974021"><span class="annot"><span class="annottext">Located (IdP GhcPs)
tcdLName :: forall pass. TyClDecl pass -&gt; Located (IdP pass)
tcdLName :: Located (IdP GhcPs)
</span><a href="GHC.Hs.Decls.html#tcdLName"><span class="hs-identifier hs-var hs-var">tcdLName</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680974019"><span class="annot"><span class="annottext">LHsQTyVars GhcPs
tcdTyVars :: forall pass. TyClDecl pass -&gt; LHsQTyVars pass
tcdTyVars :: LHsQTyVars GhcPs
</span><a href="GHC.Hs.Decls.html#tcdTyVars"><span class="hs-identifier hs-var hs-var">tcdTyVars</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680974017"><span class="annot"><span class="annottext">LexicalFixity
tcdFixity :: forall pass. TyClDecl pass -&gt; LexicalFixity
tcdFixity :: LexicalFixity
</span><a href="GHC.Hs.Decls.html#tcdFixity"><span class="hs-identifier hs-var hs-var">tcdFixity</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">tcdDataDefn :: forall pass. TyClDecl pass -&gt; HsDataDefn pass
</span><a href="GHC.Hs.Decls.html#tcdDataDefn"><span class="hs-identifier hs-var">tcdDataDefn</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680974014"><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621680974014"><span class="hs-identifier hs-var">defn</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyClDecl GhcPs
</span><a href="#local-6989586621680974023"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-475"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-476"></span><span>        </span><span class="annot"><span class="annottext">Located RdrName -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">Located RdrName
Located (IdP GhcPs)
</span><a href="#local-6989586621680974021"><span class="hs-identifier hs-var">tcdLName</span></a></span><span>
</span><span id="line-477"></span><span>        </span><span id="local-6989586621680974013"><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621680974013"><span class="hs-identifier hs-var">defn'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs -&gt; HdkA (HsDataDefn GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621680974014"><span class="hs-identifier hs-var">defn</span></a></span><span>
</span><span id="line-478"></span><span>        </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-479"></span><span>          </span><span class="annot"><span class="annottext">XTyClD GhcPs -&gt; TyClDecl GhcPs -&gt; HsDecl GhcPs
forall p. XTyClD p -&gt; TyClDecl p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#TyClD"><span class="hs-identifier hs-var">TyClD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XTyClD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataDecl :: forall pass.
XDataDecl pass
-&gt; Located (IdP pass)
-&gt; LHsQTyVars pass
-&gt; LexicalFixity
-&gt; HsDataDefn pass
-&gt; TyClDecl pass
</span><a href="GHC.Hs.Decls.html#DataDecl"><span class="hs-identifier hs-type">DataDecl</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-480"></span><span>            </span><span class="annot"><span class="annottext">tcdDExt :: XDataDecl GhcPs
</span><a href="#local-6989586621680974012"><span class="hs-identifier hs-var">tcdDExt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NoExtField
XDataDecl GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-481"></span><span>            </span><span class="annot"><span class="annottext">Located (IdP GhcPs)
tcdLName :: Located (IdP GhcPs)
tcdLName :: Located (IdP GhcPs)
</span><a href="GHC.Hs.Decls.html#tcdLName"><span class="hs-identifier hs-var hs-var">tcdLName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsQTyVars GhcPs
tcdTyVars :: LHsQTyVars GhcPs
tcdTyVars :: LHsQTyVars GhcPs
</span><a href="GHC.Hs.Decls.html#tcdTyVars"><span class="hs-identifier hs-var hs-var">tcdTyVars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LexicalFixity
tcdFixity :: LexicalFixity
tcdFixity :: LexicalFixity
</span><a href="GHC.Hs.Decls.html#tcdFixity"><span class="hs-identifier hs-var hs-var">tcdFixity</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-482"></span><span>            </span><span class="annot"><span class="annottext">tcdDataDefn :: HsDataDefn GhcPs
</span><a href="GHC.Hs.Decls.html#tcdDataDefn"><span class="hs-identifier hs-var">tcdDataDefn</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621680974013"><span class="hs-identifier hs-var">defn'</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-483"></span><span>
</span><span id="line-484"></span><span>  </span><span class="hs-comment">-- Class declarations:</span><span>
</span><span id="line-485"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-486"></span><span>  </span><span class="hs-comment">--  class C a where</span><span>
</span><span id="line-487"></span><span>  </span><span class="hs-comment">--      -- | Comment on the first method</span><span>
</span><span id="line-488"></span><span>  </span><span class="hs-comment">--      first_method :: a -&gt; Bool</span><span>
</span><span id="line-489"></span><span>  </span><span class="hs-comment">--      second_method :: a -&gt; String</span><span>
</span><span id="line-490"></span><span>  </span><span class="hs-comment">--      -- ^ Comment on the second method</span><span>
</span><span id="line-491"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-492"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#TyClD"><span class="hs-identifier hs-type">TyClD</span></a></span><span> </span><span class="annot"><span class="annottext">XTyClD GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680974011"><span class="annot"><span class="annottext">TyClDecl GhcPs
</span><a href="#local-6989586621680974011"><span class="hs-identifier hs-var">decl</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-493"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#ClassDecl"><span class="hs-identifier hs-type">ClassDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcdCExt :: forall pass. TyClDecl pass -&gt; XClassDecl pass
</span><a href="GHC.Hs.Decls.html#tcdCExt"><span class="hs-identifier hs-var">tcdCExt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680974008"><span class="annot"><span class="annottext">XClassDecl GhcPs
</span><a href="#local-6989586621680974008"><span class="hs-identifier hs-var">tcdLayout</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-494"></span><span>                  </span><span id="local-6989586621680974007"><span class="annot"><span class="annottext">LHsContext GhcPs
tcdCtxt :: forall pass. TyClDecl pass -&gt; LHsContext pass
tcdCtxt :: LHsContext GhcPs
</span><a href="GHC.Hs.Decls.html#tcdCtxt"><span class="hs-identifier hs-var hs-var">tcdCtxt</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680974005"><span class="annot"><span class="annottext">Located (IdP GhcPs)
tcdLName :: Located (IdP GhcPs)
tcdLName :: forall pass. TyClDecl pass -&gt; Located (IdP pass)
</span><a href="#local-6989586621680974005"><span class="hs-identifier hs-var hs-var">tcdLName</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680974004"><span class="annot"><span class="annottext">LHsQTyVars GhcPs
tcdTyVars :: LHsQTyVars GhcPs
tcdTyVars :: forall pass. TyClDecl pass -&gt; LHsQTyVars pass
</span><a href="#local-6989586621680974004"><span class="hs-identifier hs-var hs-var">tcdTyVars</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680974003"><span class="annot"><span class="annottext">LexicalFixity
tcdFixity :: LexicalFixity
tcdFixity :: forall pass. TyClDecl pass -&gt; LexicalFixity
</span><a href="#local-6989586621680974003"><span class="hs-identifier hs-var hs-var">tcdFixity</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680974002"><span class="annot"><span class="annottext">[LHsFunDep GhcPs]
tcdFDs :: forall pass. TyClDecl pass -&gt; [LHsFunDep pass]
tcdFDs :: [LHsFunDep GhcPs]
</span><a href="GHC.Hs.Decls.html#tcdFDs"><span class="hs-identifier hs-var hs-var">tcdFDs</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-495"></span><span>                  </span><span id="local-6989586621680974000"><span class="annot"><span class="annottext">[LSig GhcPs]
tcdSigs :: forall pass. TyClDecl pass -&gt; [LSig pass]
tcdSigs :: [LSig GhcPs]
</span><a href="GHC.Hs.Decls.html#tcdSigs"><span class="hs-identifier hs-var hs-var">tcdSigs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973998"><span class="annot"><span class="annottext">LHsBinds GhcPs
tcdMeths :: forall pass. TyClDecl pass -&gt; LHsBinds pass
tcdMeths :: LHsBinds GhcPs
</span><a href="GHC.Hs.Decls.html#tcdMeths"><span class="hs-identifier hs-var hs-var">tcdMeths</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973996"><span class="annot"><span class="annottext">[LFamilyDecl GhcPs]
tcdATs :: forall pass. TyClDecl pass -&gt; [LFamilyDecl pass]
tcdATs :: [LFamilyDecl GhcPs]
</span><a href="GHC.Hs.Decls.html#tcdATs"><span class="hs-identifier hs-var hs-var">tcdATs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973994"><span class="annot"><span class="annottext">[LTyFamDefltDecl GhcPs]
tcdATDefs :: forall pass. TyClDecl pass -&gt; [LTyFamDefltDecl pass]
tcdATDefs :: [LTyFamDefltDecl GhcPs]
</span><a href="GHC.Hs.Decls.html#tcdATDefs"><span class="hs-identifier hs-var hs-var">tcdATDefs</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyClDecl GhcPs
</span><a href="#local-6989586621680974011"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-496"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-497"></span><span>        </span><span class="annot"><span class="annottext">Located RdrName -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">Located RdrName
Located (IdP GhcPs)
</span><a href="#local-6989586621680974005"><span class="hs-identifier hs-var">tcdLName</span></a></span><span>
</span><span id="line-498"></span><span>        </span><span class="hs-comment">-- todo: register keyword location of 'where', see Note [Register keyword location]</span><span>
</span><span id="line-499"></span><span>        </span><span id="local-6989586621680973992"><span class="annot"><span class="annottext">[LHsDecl GhcPs]
</span><a href="#local-6989586621680973992"><span class="hs-identifier hs-var">where_cls'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-500"></span><span>          </span><span class="annot"><span class="annottext">LayoutInfo
-&gt; (PsLocated HdkComment -&gt; Maybe (LHsDecl GhcPs))
-&gt; [LHsDecl GhcPs]
-&gt; HdkA [LHsDecl GhcPs]
forall a.
HasHaddock a =&gt;
LayoutInfo -&gt; (PsLocated HdkComment -&gt; Maybe a) -&gt; [a] -&gt; HdkA [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockInterleaveItems"><span class="hs-identifier hs-var">addHaddockInterleaveItems</span></a></span><span> </span><span class="annot"><span class="annottext">LayoutInfo
XClassDecl GhcPs
</span><a href="#local-6989586621680974008"><span class="hs-identifier hs-var">tcdLayout</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LayoutInfo -&gt; PsLocated HdkComment -&gt; Maybe (LHsDecl GhcPs)
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocHsDecl"><span class="hs-identifier hs-var">mkDocHsDecl</span></a></span><span> </span><span class="annot"><span class="annottext">LayoutInfo
XClassDecl GhcPs
</span><a href="#local-6989586621680974008"><span class="hs-identifier hs-var">tcdLayout</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([LHsDecl GhcPs] -&gt; HdkA [LHsDecl GhcPs])
-&gt; [LHsDecl GhcPs] -&gt; HdkA [LHsDecl GhcPs]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-501"></span><span>          </span><span class="annot"><span class="annottext">(LHsBinds GhcPs, [LSig GhcPs], [LFamilyDecl GhcPs],
 [LTyFamDefltDecl GhcPs], [LDataFamInstDecl GhcPs], [LDocDecl])
-&gt; [LHsDecl GhcPs]
</span><a href="GHC.Parser.PostProcess.Haddock.html#flattenBindsAndSigs"><span class="hs-identifier hs-var">flattenBindsAndSigs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBinds GhcPs
</span><a href="#local-6989586621680973998"><span class="hs-identifier hs-var">tcdMeths</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LSig GhcPs]
</span><a href="#local-6989586621680974000"><span class="hs-identifier hs-var">tcdSigs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LFamilyDecl GhcPs]
</span><a href="#local-6989586621680973996"><span class="hs-identifier hs-var">tcdATs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LTyFamDefltDecl GhcPs]
</span><a href="#local-6989586621680973994"><span class="hs-identifier hs-var">tcdATDefs</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-502"></span><span>        </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-503"></span><span>          </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680973990"><span class="annot"><span class="annottext">LHsBinds GhcPs
</span><a href="#local-6989586621680973990"><span class="hs-identifier hs-var">tcdMeths'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973989"><span class="annot"><span class="annottext">[LSig GhcPs]
</span><a href="#local-6989586621680973989"><span class="hs-identifier hs-var">tcdSigs'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973988"><span class="annot"><span class="annottext">[LFamilyDecl GhcPs]
</span><a href="#local-6989586621680973988"><span class="hs-identifier hs-var">tcdATs'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973987"><span class="annot"><span class="annottext">[LTyFamDefltDecl GhcPs]
</span><a href="#local-6989586621680973987"><span class="hs-identifier hs-var">tcdATDefs'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LDataFamInstDecl GhcPs]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973986"><span class="annot"><span class="annottext">[LDocDecl]
</span><a href="#local-6989586621680973986"><span class="hs-identifier hs-var">tcdDocs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LHsDecl GhcPs]
-&gt; (LHsBinds GhcPs, [LSig GhcPs], [LFamilyDecl GhcPs],
    [LTyFamDefltDecl GhcPs], [LDataFamInstDecl GhcPs], [LDocDecl])
</span><a href="GHC.Hs.Decls.html#partitionBindsAndSigs"><span class="hs-identifier hs-var">partitionBindsAndSigs</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsDecl GhcPs]
</span><a href="#local-6989586621680973992"><span class="hs-identifier hs-var">where_cls'</span></a></span><span>
</span><span id="line-504"></span><span>              </span><span id="local-6989586621680973984"><span class="annot"><span class="annottext">decl' :: TyClDecl GhcPs
</span><a href="#local-6989586621680973984"><span class="hs-identifier hs-var hs-var">decl'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClassDecl :: forall pass.
XClassDecl pass
-&gt; LHsContext pass
-&gt; Located (IdP pass)
-&gt; LHsQTyVars pass
-&gt; LexicalFixity
-&gt; [LHsFunDep pass]
-&gt; [LSig pass]
-&gt; LHsBinds pass
-&gt; [LFamilyDecl pass]
-&gt; [LTyFamDefltDecl pass]
-&gt; [LDocDecl]
-&gt; TyClDecl pass
</span><a href="GHC.Hs.Decls.html#ClassDecl"><span class="hs-identifier hs-type">ClassDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcdCExt :: XClassDecl GhcPs
</span><a href="GHC.Hs.Decls.html#tcdCExt"><span class="hs-identifier hs-var">tcdCExt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XClassDecl GhcPs
</span><a href="#local-6989586621680974008"><span class="hs-identifier hs-var">tcdLayout</span></a></span><span>
</span><span id="line-505"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsContext GhcPs
tcdCtxt :: LHsContext GhcPs
tcdCtxt :: LHsContext GhcPs
</span><a href="GHC.Hs.Decls.html#tcdCtxt"><span class="hs-identifier hs-var hs-var">tcdCtxt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located (IdP GhcPs)
tcdLName :: Located (IdP GhcPs)
tcdLName :: Located (IdP GhcPs)
</span><a href="#local-6989586621680974005"><span class="hs-identifier hs-var hs-var">tcdLName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsQTyVars GhcPs
tcdTyVars :: LHsQTyVars GhcPs
tcdTyVars :: LHsQTyVars GhcPs
</span><a href="#local-6989586621680974004"><span class="hs-identifier hs-var hs-var">tcdTyVars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LexicalFixity
tcdFixity :: LexicalFixity
tcdFixity :: LexicalFixity
</span><a href="#local-6989586621680974003"><span class="hs-identifier hs-var hs-var">tcdFixity</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LHsFunDep GhcPs]
tcdFDs :: [LHsFunDep GhcPs]
tcdFDs :: [LHsFunDep GhcPs]
</span><a href="GHC.Hs.Decls.html#tcdFDs"><span class="hs-identifier hs-var hs-var">tcdFDs</span></a></span><span>
</span><span id="line-506"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">tcdSigs :: [LSig GhcPs]
</span><a href="GHC.Hs.Decls.html#tcdSigs"><span class="hs-identifier hs-var">tcdSigs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LSig GhcPs]
</span><a href="#local-6989586621680973989"><span class="hs-identifier hs-var">tcdSigs'</span></a></span><span>
</span><span id="line-507"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">tcdMeths :: LHsBinds GhcPs
</span><a href="GHC.Hs.Decls.html#tcdMeths"><span class="hs-identifier hs-var">tcdMeths</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsBinds GhcPs
</span><a href="#local-6989586621680973990"><span class="hs-identifier hs-var">tcdMeths'</span></a></span><span>
</span><span id="line-508"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">tcdATs :: [LFamilyDecl GhcPs]
</span><a href="GHC.Hs.Decls.html#tcdATs"><span class="hs-identifier hs-var">tcdATs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LFamilyDecl GhcPs]
</span><a href="#local-6989586621680973988"><span class="hs-identifier hs-var">tcdATs'</span></a></span><span>
</span><span id="line-509"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">tcdATDefs :: [LTyFamDefltDecl GhcPs]
</span><a href="GHC.Hs.Decls.html#tcdATDefs"><span class="hs-identifier hs-var">tcdATDefs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LTyFamDefltDecl GhcPs]
</span><a href="#local-6989586621680973987"><span class="hs-identifier hs-var">tcdATDefs'</span></a></span><span>
</span><span id="line-510"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LDocDecl]
tcdDocs :: [LDocDecl]
tcdDocs :: [LDocDecl]
</span><a href="#local-6989586621680973983"><span class="hs-identifier hs-var hs-var">tcdDocs</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-511"></span><span>          </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">XTyClD GhcPs -&gt; TyClDecl GhcPs -&gt; HsDecl GhcPs
forall p. XTyClD p -&gt; TyClDecl p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#TyClD"><span class="hs-identifier hs-var">TyClD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XTyClD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">TyClDecl GhcPs
</span><a href="#local-6989586621680973984"><span class="hs-identifier hs-var">decl'</span></a></span><span>
</span><span id="line-512"></span><span>
</span><span id="line-513"></span><span>  </span><span class="hs-comment">-- Data family instances:</span><span>
</span><span id="line-514"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-515"></span><span>  </span><span class="hs-comment">--    data instance D Bool where ... (same as data/newtype declarations)</span><span>
</span><span id="line-516"></span><span>  </span><span class="hs-comment">--    data instance D Bool = ...     (same as data/newtype declarations)</span><span>
</span><span id="line-517"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-518"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#InstD"><span class="hs-identifier hs-type">InstD</span></a></span><span> </span><span class="annot"><span class="annottext">XInstD GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680973981"><span class="annot"><span class="annottext">InstDecl GhcPs
</span><a href="#local-6989586621680973981"><span class="hs-identifier hs-var">decl</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-519"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#DataFamInstD"><span class="hs-identifier hs-type">DataFamInstD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680973979"><span class="annot"><span class="annottext">DataFamInstDecl GhcPs
dfid_inst :: forall pass. InstDecl pass -&gt; DataFamInstDecl pass
dfid_inst :: DataFamInstDecl GhcPs
</span><a href="GHC.Hs.Decls.html#dfid_inst"><span class="hs-identifier hs-var hs-var">dfid_inst</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">InstDecl GhcPs
</span><a href="#local-6989586621680973981"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-520"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#DataFamInstDecl"><span class="hs-identifier hs-type">DataFamInstDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680973976"><span class="annot"><span class="annottext">FamInstEqn GhcPs (HsDataDefn GhcPs)
dfid_eqn :: forall pass.
DataFamInstDecl pass -&gt; FamInstEqn pass (HsDataDefn pass)
dfid_eqn :: FamInstEqn GhcPs (HsDataDefn GhcPs)
</span><a href="GHC.Hs.Decls.html#dfid_eqn"><span class="hs-identifier hs-var hs-var">dfid_eqn</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DataFamInstDecl GhcPs
</span><a href="#local-6989586621680973979"><span class="hs-identifier hs-var">dfid_inst</span></a></span><span>
</span><span id="line-521"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-522"></span><span>      </span><span id="local-6989586621680973974"><span class="annot"><span class="annottext">FamInstEqn GhcPs (HsDataDefn GhcPs)
</span><a href="#local-6989586621680973974"><span class="hs-identifier hs-var">dfid_eqn'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">FamInstEqn GhcPs (HsDataDefn GhcPs)
</span><a href="#local-6989586621680973976"><span class="hs-identifier hs-var">dfid_eqn</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-523"></span><span>        </span><span class="annot"><a href="GHC.Hs.Type.html#HsIB"><span class="hs-identifier hs-type">HsIB</span></a></span><span> </span><span class="annot"><span class="annottext">XHsIB GhcPs (FamEqn GhcPs (HsDataDefn GhcPs))
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#FamEqn"><span class="hs-identifier hs-type">FamEqn</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680973971"><span class="annot"><span class="annottext">Located (IdP GhcPs)
feqn_tycon :: forall pass rhs. FamEqn pass rhs -&gt; Located (IdP pass)
feqn_tycon :: Located (IdP GhcPs)
</span><a href="GHC.Hs.Decls.html#feqn_tycon"><span class="hs-identifier hs-var hs-var">feqn_tycon</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973969"><span class="annot"><span class="annottext">Maybe [LHsTyVarBndr () GhcPs]
feqn_bndrs :: forall pass rhs. FamEqn pass rhs -&gt; Maybe [LHsTyVarBndr () pass]
feqn_bndrs :: Maybe [LHsTyVarBndr () GhcPs]
</span><a href="GHC.Hs.Decls.html#feqn_bndrs"><span class="hs-identifier hs-var hs-var">feqn_bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973967"><span class="annot"><span class="annottext">HsTyPats GhcPs
feqn_pats :: forall pass rhs. FamEqn pass rhs -&gt; HsTyPats pass
feqn_pats :: HsTyPats GhcPs
</span><a href="GHC.Hs.Decls.html#feqn_pats"><span class="hs-identifier hs-var hs-var">feqn_pats</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973965"><span class="annot"><span class="annottext">LexicalFixity
feqn_fixity :: forall pass rhs. FamEqn pass rhs -&gt; LexicalFixity
feqn_fixity :: LexicalFixity
</span><a href="GHC.Hs.Decls.html#feqn_fixity"><span class="hs-identifier hs-var hs-var">feqn_fixity</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973963"><span class="annot"><span class="annottext">HsDataDefn GhcPs
feqn_rhs :: forall pass rhs. FamEqn pass rhs -&gt; rhs
feqn_rhs :: HsDataDefn GhcPs
</span><a href="GHC.Hs.Decls.html#feqn_rhs"><span class="hs-identifier hs-var hs-var">feqn_rhs</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-524"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-525"></span><span>            </span><span class="annot"><span class="annottext">Located RdrName -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">Located RdrName
Located (IdP GhcPs)
</span><a href="#local-6989586621680973971"><span class="hs-identifier hs-var">feqn_tycon</span></a></span><span>
</span><span id="line-526"></span><span>            </span><span id="local-6989586621680973961"><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621680973961"><span class="hs-identifier hs-var">feqn_rhs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs -&gt; HdkA (HsDataDefn GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621680973963"><span class="hs-identifier hs-var">feqn_rhs</span></a></span><span>
</span><span id="line-527"></span><span>            </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-528"></span><span>              </span><span class="annot"><span class="annottext">XHsIB GhcPs (FamEqn GhcPs (HsDataDefn GhcPs))
-&gt; FamEqn GhcPs (HsDataDefn GhcPs)
-&gt; FamInstEqn GhcPs (HsDataDefn GhcPs)
forall pass thing.
XHsIB pass thing -&gt; thing -&gt; HsImplicitBndrs pass thing
</span><a href="GHC.Hs.Type.html#HsIB"><span class="hs-identifier hs-var">HsIB</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XHsIB GhcPs (FamEqn GhcPs (HsDataDefn GhcPs))
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FamEqn :: forall pass rhs.
XCFamEqn pass rhs
-&gt; Located (IdP pass)
-&gt; Maybe [LHsTyVarBndr () pass]
-&gt; HsTyPats pass
-&gt; LexicalFixity
-&gt; rhs
-&gt; FamEqn pass rhs
</span><a href="GHC.Hs.Decls.html#FamEqn"><span class="hs-identifier hs-type">FamEqn</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-529"></span><span>                </span><span class="annot"><span class="annottext">feqn_ext :: XCFamEqn GhcPs (HsDataDefn GhcPs)
</span><a href="#local-6989586621680973960"><span class="hs-identifier hs-var">feqn_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NoExtField
XCFamEqn GhcPs (HsDataDefn GhcPs)
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-530"></span><span>                </span><span class="annot"><span class="annottext">Located (IdP GhcPs)
feqn_tycon :: Located (IdP GhcPs)
feqn_tycon :: Located (IdP GhcPs)
</span><a href="GHC.Hs.Decls.html#feqn_tycon"><span class="hs-identifier hs-var hs-var">feqn_tycon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe [LHsTyVarBndr () GhcPs]
feqn_bndrs :: Maybe [LHsTyVarBndr () GhcPs]
feqn_bndrs :: Maybe [LHsTyVarBndr () GhcPs]
</span><a href="GHC.Hs.Decls.html#feqn_bndrs"><span class="hs-identifier hs-var hs-var">feqn_bndrs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HsTyPats GhcPs
feqn_pats :: HsTyPats GhcPs
feqn_pats :: HsTyPats GhcPs
</span><a href="GHC.Hs.Decls.html#feqn_pats"><span class="hs-identifier hs-var hs-var">feqn_pats</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LexicalFixity
feqn_fixity :: LexicalFixity
feqn_fixity :: LexicalFixity
</span><a href="GHC.Hs.Decls.html#feqn_fixity"><span class="hs-identifier hs-var hs-var">feqn_fixity</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-531"></span><span>                </span><span class="annot"><span class="annottext">feqn_rhs :: HsDataDefn GhcPs
</span><a href="GHC.Hs.Decls.html#feqn_rhs"><span class="hs-identifier hs-var">feqn_rhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621680973961"><span class="hs-identifier hs-var">feqn_rhs'</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-532"></span><span>      </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">XInstD GhcPs -&gt; InstDecl GhcPs -&gt; HsDecl GhcPs
forall p. XInstD p -&gt; InstDecl p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#InstD"><span class="hs-identifier hs-var">InstD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XInstD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataFamInstD :: forall pass.
XDataFamInstD pass -&gt; DataFamInstDecl pass -&gt; InstDecl pass
</span><a href="GHC.Hs.Decls.html#DataFamInstD"><span class="hs-identifier hs-type">DataFamInstD</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-533"></span><span>        </span><span class="annot"><span class="annottext">dfid_ext :: XDataFamInstD GhcPs
</span><a href="#local-6989586621680973959"><span class="hs-identifier hs-var">dfid_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NoExtField
XDataFamInstD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-534"></span><span>        </span><span class="annot"><span class="annottext">dfid_inst :: DataFamInstDecl GhcPs
</span><a href="GHC.Hs.Decls.html#dfid_inst"><span class="hs-identifier hs-var">dfid_inst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataFamInstDecl :: forall pass.
FamInstEqn pass (HsDataDefn pass) -&gt; DataFamInstDecl pass
</span><a href="GHC.Hs.Decls.html#DataFamInstDecl"><span class="hs-identifier hs-type">DataFamInstDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">dfid_eqn :: FamInstEqn GhcPs (HsDataDefn GhcPs)
</span><a href="GHC.Hs.Decls.html#dfid_eqn"><span class="hs-identifier hs-var">dfid_eqn</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FamInstEqn GhcPs (HsDataDefn GhcPs)
</span><a href="#local-6989586621680973974"><span class="hs-identifier hs-var">dfid_eqn'</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-535"></span><span>
</span><span id="line-536"></span><span>  </span><span class="hs-comment">-- Type synonyms:</span><span>
</span><span id="line-537"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-538"></span><span>  </span><span class="hs-comment">--    type T = Int -- ^ Comment on Int</span><span>
</span><span id="line-539"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-540"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#TyClD"><span class="hs-identifier hs-type">TyClD</span></a></span><span> </span><span class="annot"><span class="annottext">XTyClD GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680973958"><span class="annot"><span class="annottext">TyClDecl GhcPs
</span><a href="#local-6989586621680973958"><span class="hs-identifier hs-var">decl</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-541"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#SynDecl"><span class="hs-identifier hs-type">SynDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680973956"><span class="annot"><span class="annottext">Located (IdP GhcPs)
tcdLName :: Located (IdP GhcPs)
tcdLName :: forall pass. TyClDecl pass -&gt; Located (IdP pass)
</span><a href="#local-6989586621680973956"><span class="hs-identifier hs-var hs-var">tcdLName</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973955"><span class="annot"><span class="annottext">LHsQTyVars GhcPs
tcdTyVars :: LHsQTyVars GhcPs
tcdTyVars :: forall pass. TyClDecl pass -&gt; LHsQTyVars pass
</span><a href="#local-6989586621680973955"><span class="hs-identifier hs-var hs-var">tcdTyVars</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973954"><span class="annot"><span class="annottext">LexicalFixity
tcdFixity :: LexicalFixity
tcdFixity :: forall pass. TyClDecl pass -&gt; LexicalFixity
</span><a href="#local-6989586621680973954"><span class="hs-identifier hs-var hs-var">tcdFixity</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973953"><span class="annot"><span class="annottext">LHsType GhcPs
tcdRhs :: forall pass. TyClDecl pass -&gt; LHsType pass
tcdRhs :: LHsType GhcPs
</span><a href="GHC.Hs.Decls.html#tcdRhs"><span class="hs-identifier hs-var hs-var">tcdRhs</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyClDecl GhcPs
</span><a href="#local-6989586621680973958"><span class="hs-identifier hs-var">decl</span></a></span><span>
</span><span id="line-542"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-543"></span><span>        </span><span class="annot"><span class="annottext">Located RdrName -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">Located RdrName
Located (IdP GhcPs)
</span><a href="#local-6989586621680973956"><span class="hs-identifier hs-var">tcdLName</span></a></span><span>
</span><span id="line-544"></span><span>        </span><span class="hs-comment">-- todo: register keyword location of '=', see Note [Register keyword location]</span><span>
</span><span id="line-545"></span><span>        </span><span id="local-6989586621680973951"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973951"><span class="hs-identifier hs-var">tcdRhs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs -&gt; HdkA (LHsType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973953"><span class="hs-identifier hs-var">tcdRhs</span></a></span><span>
</span><span id="line-546"></span><span>        </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-547"></span><span>          </span><span class="annot"><span class="annottext">XTyClD GhcPs -&gt; TyClDecl GhcPs -&gt; HsDecl GhcPs
forall p. XTyClD p -&gt; TyClDecl p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#TyClD"><span class="hs-identifier hs-var">TyClD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XTyClD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SynDecl :: forall pass.
XSynDecl pass
-&gt; Located (IdP pass)
-&gt; LHsQTyVars pass
-&gt; LexicalFixity
-&gt; LHsType pass
-&gt; TyClDecl pass
</span><a href="GHC.Hs.Decls.html#SynDecl"><span class="hs-identifier hs-type">SynDecl</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-548"></span><span>            </span><span class="annot"><span class="annottext">tcdSExt :: XSynDecl GhcPs
</span><a href="#local-6989586621680973950"><span class="hs-identifier hs-var">tcdSExt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NoExtField
XSynDecl GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-549"></span><span>            </span><span class="annot"><span class="annottext">Located (IdP GhcPs)
tcdLName :: Located (IdP GhcPs)
tcdLName :: Located (IdP GhcPs)
</span><a href="#local-6989586621680973956"><span class="hs-identifier hs-var hs-var">tcdLName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsQTyVars GhcPs
tcdTyVars :: LHsQTyVars GhcPs
tcdTyVars :: LHsQTyVars GhcPs
</span><a href="#local-6989586621680973955"><span class="hs-identifier hs-var hs-var">tcdTyVars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LexicalFixity
tcdFixity :: LexicalFixity
tcdFixity :: LexicalFixity
</span><a href="#local-6989586621680973954"><span class="hs-identifier hs-var hs-var">tcdFixity</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-550"></span><span>            </span><span class="annot"><span class="annottext">tcdRhs :: LHsType GhcPs
</span><a href="GHC.Hs.Decls.html#tcdRhs"><span class="hs-identifier hs-var">tcdRhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973951"><span class="hs-identifier hs-var">tcdRhs'</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-551"></span><span>
</span><span id="line-552"></span><span>  </span><span class="hs-comment">-- Foreign imports:</span><span>
</span><span id="line-553"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-554"></span><span>  </span><span class="hs-comment">--    foreign import ccall unsafe</span><span>
</span><span id="line-555"></span><span>  </span><span class="hs-comment">--      o :: Float     -- ^ The input float</span><span>
</span><span id="line-556"></span><span>  </span><span class="hs-comment">--        -&gt; IO Float  -- ^ The output float</span><span>
</span><span id="line-557"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-558"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#ForD"><span class="hs-identifier hs-type">ForD</span></a></span><span> </span><span class="annot"><span class="annottext">XForD GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680973948"><span class="annot"><span class="annottext">ForeignDecl GhcPs
</span><a href="#local-6989586621680973948"><span class="hs-identifier hs-var">decl</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-559"></span><span>    </span><span class="annot"><span class="annottext">Located RdrName -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ForeignDecl GhcPs -&gt; Located (IdP GhcPs)
forall pass. ForeignDecl pass -&gt; Located (IdP pass)
</span><a href="GHC.Hs.Decls.html#fd_name"><span class="hs-identifier hs-var hs-var">fd_name</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignDecl GhcPs
</span><a href="#local-6989586621680973948"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-560"></span><span>    </span><span id="local-6989586621680973946"><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680973946"><span class="hs-identifier hs-var">fd_sig_ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs -&gt; HdkA (LHsSigType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ForeignDecl GhcPs -&gt; LHsSigType GhcPs
forall pass. ForeignDecl pass -&gt; LHsSigType pass
</span><a href="GHC.Hs.Decls.html#fd_sig_ty"><span class="hs-identifier hs-var hs-var">fd_sig_ty</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignDecl GhcPs
</span><a href="#local-6989586621680973948"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-561"></span><span>    </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">XForD GhcPs -&gt; ForeignDecl GhcPs -&gt; HsDecl GhcPs
forall p. XForD p -&gt; ForeignDecl p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#ForD"><span class="hs-identifier hs-var">ForD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XForD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ForeignDecl GhcPs
</span><a href="#local-6989586621680973948"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fd_sig_ty :: LHsSigType GhcPs
</span><a href="GHC.Hs.Decls.html#fd_sig_ty"><span class="hs-identifier hs-var">fd_sig_ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680973946"><span class="hs-identifier hs-var">fd_sig_ty'</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-562"></span><span>
</span><span id="line-563"></span><span>  </span><span class="hs-comment">-- Other declarations</span><span>
</span><span id="line-564"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span id="local-6989586621680973944"><span class="annot"><span class="annottext">HsDecl GhcPs
</span><a href="#local-6989586621680973944"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsDecl GhcPs -&gt; HdkA (HsDecl GhcPs)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">HsDecl GhcPs
</span><a href="#local-6989586621680973944"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-565"></span><span>
</span><span id="line-566"></span><span class="hs-comment">-- The right-hand side of a data/newtype declaration or data family instance.</span><span>
</span><span id="line-567"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#HsDataDefn"><span class="hs-identifier hs-type">HsDataDefn</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-568"></span><span>  </span><span id="local-6989586621680973931"><span class="annot"><span class="annottext">addHaddock :: HsDataDefn GhcPs -&gt; HdkA (HsDataDefn GhcPs)
</span><a href="#local-6989586621680973931"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span id="local-6989586621680973930"><span class="annot"><span class="annottext">defn :: HsDataDefn GhcPs
</span><a href="#local-6989586621680973930"><span class="hs-identifier hs-var">defn</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Hs.Decls.html#HsDataDefn"><span class="hs-identifier hs-type">HsDataDefn</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-569"></span><span>
</span><span id="line-570"></span><span>    </span><span class="hs-comment">-- Register the kind signature:</span><span>
</span><span id="line-571"></span><span>    </span><span class="hs-comment">--    data D :: Type -&gt; Type        where ...</span><span>
</span><span id="line-572"></span><span>    </span><span class="hs-comment">--    data instance D Bool :: Type  where ...</span><span>
</span><span id="line-573"></span><span>    </span><span class="annot"><span class="annottext">forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Foldable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f ()
</span><a href="../../base/src/Data.Foldable.html#traverse_"><span class="hs-identifier hs-var">traverse_</span></a></span><span> </span><span class="hs-glyph">@</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsDataDefn GhcPs -&gt; Maybe (LHsType GhcPs)
forall pass. HsDataDefn pass -&gt; Maybe (LHsKind pass)
</span><a href="GHC.Hs.Decls.html#dd_kindSig"><span class="hs-identifier hs-var hs-var">dd_kindSig</span></a></span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621680973930"><span class="hs-identifier hs-var">defn</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-574"></span><span>    </span><span class="hs-comment">-- todo: register keyword location of '=' or 'where', see Note [Register keyword location]</span><span>
</span><span id="line-575"></span><span>
</span><span id="line-576"></span><span>    </span><span class="hs-comment">-- Process the data constructors:</span><span>
</span><span id="line-577"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-578"></span><span>    </span><span class="hs-comment">--    data T</span><span>
</span><span id="line-579"></span><span>    </span><span class="hs-comment">--      = MkT1 Int Bool  -- ^ Comment on MkT1</span><span>
</span><span id="line-580"></span><span>    </span><span class="hs-comment">--      | MkT2 Char Int  -- ^ Comment on MkT2</span><span>
</span><span id="line-581"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-582"></span><span>    </span><span id="local-6989586621680973927"><span class="annot"><span class="annottext">[LConDecl GhcPs]
</span><a href="#local-6989586621680973927"><span class="hs-identifier hs-var">dd_cons'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LConDecl GhcPs] -&gt; HdkA [LConDecl GhcPs]
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsDataDefn GhcPs -&gt; [LConDecl GhcPs]
forall pass. HsDataDefn pass -&gt; [LConDecl pass]
</span><a href="GHC.Hs.Decls.html#dd_cons"><span class="hs-identifier hs-var hs-var">dd_cons</span></a></span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621680973930"><span class="hs-identifier hs-var">defn</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-583"></span><span>
</span><span id="line-584"></span><span>    </span><span class="hs-comment">-- Process the deriving clauses:</span><span>
</span><span id="line-585"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-586"></span><span>    </span><span class="hs-comment">--   newtype N = MkN Natural</span><span>
</span><span id="line-587"></span><span>    </span><span class="hs-comment">--     deriving (Eq  {- ^ Comment on Eq  N -})</span><span>
</span><span id="line-588"></span><span>    </span><span class="hs-comment">--     deriving (Ord {- ^ Comment on Ord N -})</span><span>
</span><span id="line-589"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-590"></span><span>    </span><span id="local-6989586621680973925"><span class="annot"><span class="annottext">HsDeriving GhcPs
</span><a href="#local-6989586621680973925"><span class="hs-identifier hs-var">dd_derivs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HsDeriving GhcPs -&gt; HdkA (HsDeriving GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsDataDefn GhcPs -&gt; HsDeriving GhcPs
forall pass. HsDataDefn pass -&gt; HsDeriving pass
</span><a href="GHC.Hs.Decls.html#dd_derivs"><span class="hs-identifier hs-var hs-var">dd_derivs</span></a></span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621680973930"><span class="hs-identifier hs-var">defn</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-591"></span><span>
</span><span id="line-592"></span><span>    </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">HsDataDefn GhcPs
</span><a href="#local-6989586621680973930"><span class="hs-identifier hs-var">defn</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">dd_cons :: [LConDecl GhcPs]
</span><a href="GHC.Hs.Decls.html#dd_cons"><span class="hs-identifier hs-var">dd_cons</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LConDecl GhcPs]
</span><a href="#local-6989586621680973927"><span class="hs-identifier hs-var">dd_cons'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-593"></span><span>                  </span><span class="annot"><span class="annottext">dd_derivs :: HsDeriving GhcPs
</span><a href="GHC.Hs.Decls.html#dd_derivs"><span class="hs-identifier hs-var">dd_derivs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsDeriving GhcPs
</span><a href="#local-6989586621680973925"><span class="hs-identifier hs-var">dd_derivs'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-594"></span><span>
</span><span id="line-595"></span><span class="hs-comment">-- Process the deriving clauses of a data/newtype declaration.</span><span>
</span><span id="line-596"></span><span class="hs-comment">-- Not used for standalone deriving.</span><span>
</span><span id="line-597"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#HsDeriving"><span class="hs-identifier hs-type">HsDeriving</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-598"></span><span>  </span><span id="local-6989586621680973917"><span class="annot"><span class="annottext">addHaddock :: HsDeriving GhcPs -&gt; HdkA (HsDeriving GhcPs)
</span><a href="#local-6989586621680973917"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span id="local-6989586621680973916"><span class="annot"><span class="annottext">HsDeriving GhcPs
</span><a href="#local-6989586621680973916"><span class="hs-identifier hs-var">lderivs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-599"></span><span>    </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkA (HsDeriving GhcPs) -&gt; HdkA (HsDeriving GhcPs)
forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var">extendHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsDeriving GhcPs -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">HsDeriving GhcPs
</span><a href="#local-6989586621680973916"><span class="hs-identifier hs-var">lderivs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(HdkA (HsDeriving GhcPs) -&gt; HdkA (HsDeriving GhcPs))
-&gt; HdkA (HsDeriving GhcPs) -&gt; HdkA (HsDeriving GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-600"></span><span>    </span><span class="annot"><span class="annottext">forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsDerivingClause GhcPs] -&gt; HdkA [LHsDerivingClause GhcPs]
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">HsDeriving GhcPs
</span><a href="#local-6989586621680973916"><span class="hs-identifier hs-var">lderivs</span></a></span><span>
</span><span id="line-601"></span><span>
</span><span id="line-602"></span><span class="hs-comment">-- Process a single deriving clause of a data/newtype declaration:</span><span>
</span><span id="line-603"></span><span class="hs-comment">--</span><span>
</span><span id="line-604"></span><span class="hs-comment">--  newtype N = MkN Natural</span><span>
</span><span id="line-605"></span><span class="hs-comment">--    deriving newtype (Eq  {- ^ Comment on Eq  N -})</span><span>
</span><span id="line-606"></span><span class="hs-comment">--    deriving (Ord {- ^ Comment on Ord N -}) via Down N</span><span>
</span><span id="line-607"></span><span class="hs-comment">--</span><span>
</span><span id="line-608"></span><span class="hs-comment">-- Not used for standalone deriving.</span><span>
</span><span id="line-609"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#LHsDerivingClause"><span class="hs-identifier hs-type">LHsDerivingClause</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-610"></span><span>  </span><span id="local-6989586621680973901"><span class="annot"><span class="annottext">addHaddock :: LHsDerivingClause GhcPs -&gt; HdkA (LHsDerivingClause GhcPs)
</span><a href="#local-6989586621680973901"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span id="local-6989586621680973900"><span class="annot"><span class="annottext">LHsDerivingClause GhcPs
</span><a href="#local-6989586621680973900"><span class="hs-identifier hs-var">lderiv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-611"></span><span>    </span><span class="annot"><span class="annottext">SrcSpan
-&gt; HdkA (LHsDerivingClause GhcPs) -&gt; HdkA (LHsDerivingClause GhcPs)
forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var">extendHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsDerivingClause GhcPs -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">LHsDerivingClause GhcPs
</span><a href="#local-6989586621680973900"><span class="hs-identifier hs-var">lderiv</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(HdkA (LHsDerivingClause GhcPs) -&gt; HdkA (LHsDerivingClause GhcPs))
-&gt; HdkA (LHsDerivingClause GhcPs) -&gt; HdkA (LHsDerivingClause GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-612"></span><span>    </span><span class="annot"><span class="annottext">forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
t a -&gt; (a -&gt; f b) -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#for"><span class="hs-identifier hs-var">for</span></a></span><span> </span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><span class="annottext">LHsDerivingClause GhcPs
</span><a href="#local-6989586621680973900"><span class="hs-identifier hs-var">lderiv</span></a></span><span> </span><span class="annot"><span class="annottext">((HsDerivingClause GhcPs -&gt; HdkA (HsDerivingClause GhcPs))
 -&gt; HdkA (LHsDerivingClause GhcPs))
-&gt; (HsDerivingClause GhcPs -&gt; HdkA (HsDerivingClause GhcPs))
-&gt; HdkA (LHsDerivingClause GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680973899"><span class="annot"><span class="annottext">HsDerivingClause GhcPs
</span><a href="#local-6989586621680973899"><span class="hs-identifier hs-var">deriv</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-613"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HsDerivingClause GhcPs
</span><a href="#local-6989586621680973899"><span class="hs-identifier hs-var">deriv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-614"></span><span>      </span><span class="annot"><a href="GHC.Hs.Decls.html#HsDerivingClause"><span class="hs-identifier hs-type">HsDerivingClause</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680973897"><span class="annot"><span class="annottext">Maybe (LDerivStrategy GhcPs)
deriv_clause_strategy :: forall pass. HsDerivingClause pass -&gt; Maybe (LDerivStrategy pass)
deriv_clause_strategy :: Maybe (LDerivStrategy GhcPs)
</span><a href="GHC.Hs.Decls.html#deriv_clause_strategy"><span class="hs-identifier hs-var hs-var">deriv_clause_strategy</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973895"><span class="annot"><span class="annottext">Located [LHsSigType GhcPs]
deriv_clause_tys :: forall pass. HsDerivingClause pass -&gt; Located [LHsSigType pass]
deriv_clause_tys :: Located [LHsSigType GhcPs]
</span><a href="GHC.Hs.Decls.html#deriv_clause_tys"><span class="hs-identifier hs-var hs-var">deriv_clause_tys</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-615"></span><span>        </span><span class="hs-keyword">let</span><span>
</span><span id="line-616"></span><span>          </span><span class="hs-comment">-- 'stock', 'anyclass', and 'newtype' strategies come</span><span>
</span><span id="line-617"></span><span>          </span><span class="hs-comment">-- before the clause types.</span><span>
</span><span id="line-618"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-619"></span><span>          </span><span class="hs-comment">-- 'via' comes after.</span><span>
</span><span id="line-620"></span><span>          </span><span class="hs-comment">--</span><span>
</span><span id="line-621"></span><span>          </span><span class="hs-comment">-- See tests/.../T11768.hs</span><span>
</span><span id="line-622"></span><span>          </span><span class="hs-special">(</span><span id="local-6989586621680973893"><span class="annot"><span class="annottext">HdkA ()
</span><a href="#local-6989586621680973893"><span class="hs-identifier hs-var">register_strategy_before</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973892"><span class="annot"><span class="annottext">HdkA ()
</span><a href="#local-6989586621680973892"><span class="hs-identifier hs-var">register_strategy_after</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-623"></span><span>            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe (LDerivStrategy GhcPs)
</span><a href="#local-6989586621680973897"><span class="hs-identifier hs-var">deriv_clause_strategy</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-624"></span><span>              </span><span class="annot"><span class="annottext">Maybe (LDerivStrategy GhcPs)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">() -&gt; HdkA ()
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">() -&gt; HdkA ()
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-625"></span><span>              </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973891"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973891"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#ViaStrategy"><span class="hs-identifier hs-type">ViaStrategy</span></a></span><span> </span><span class="annot"><span class="annottext">XViaStrategy GhcPs
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">() -&gt; HdkA ()
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerLocHdkA"><span class="hs-identifier hs-var">registerLocHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973891"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-626"></span><span>              </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973889"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973889"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="annottext">DerivStrategy GhcPs
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerLocHdkA"><span class="hs-identifier hs-var">registerLocHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973889"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">() -&gt; HdkA ()
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-627"></span><span>        </span><span class="annot"><span class="annottext">HdkA ()
</span><a href="#local-6989586621680973893"><span class="hs-identifier hs-var">register_strategy_before</span></a></span><span>
</span><span id="line-628"></span><span>        </span><span id="local-6989586621680973888"><span class="annot"><span class="annottext">Located [LHsSigType GhcPs]
</span><a href="#local-6989586621680973888"><span class="hs-identifier hs-var">deriv_clause_tys'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-629"></span><span>          </span><span class="annot"><span class="annottext">SrcSpan
-&gt; HdkA (Located [LHsSigType GhcPs])
-&gt; HdkA (Located [LHsSigType GhcPs])
forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var">extendHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located [LHsSigType GhcPs] -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located [LHsSigType GhcPs]
</span><a href="#local-6989586621680973895"><span class="hs-identifier hs-var">deriv_clause_tys</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(HdkA (Located [LHsSigType GhcPs])
 -&gt; HdkA (Located [LHsSigType GhcPs]))
-&gt; HdkA (Located [LHsSigType GhcPs])
-&gt; HdkA (Located [LHsSigType GhcPs])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-630"></span><span>          </span><span class="annot"><span class="annottext">forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsSigType GhcPs] -&gt; HdkA [LHsSigType GhcPs]
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">Located [LHsSigType GhcPs]
</span><a href="#local-6989586621680973895"><span class="hs-identifier hs-var">deriv_clause_tys</span></a></span><span>
</span><span id="line-631"></span><span>        </span><span class="annot"><span class="annottext">HdkA ()
</span><a href="#local-6989586621680973892"><span class="hs-identifier hs-var">register_strategy_after</span></a></span><span>
</span><span id="line-632"></span><span>        </span><span class="hs-identifier">pure</span><span> </span><span class="annot"><span class="annottext">HsDerivingClause :: forall pass.
XCHsDerivingClause pass
-&gt; Maybe (LDerivStrategy pass)
-&gt; Located [LHsSigType pass]
-&gt; HsDerivingClause pass
</span><a href="GHC.Hs.Decls.html#HsDerivingClause"><span class="hs-identifier hs-type">HsDerivingClause</span></a></span><span>
</span><span id="line-633"></span><span>          </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">deriv_clause_ext :: XCHsDerivingClause GhcPs
</span><a href="#local-6989586621680973887"><span class="hs-identifier hs-var">deriv_clause_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NoExtField
XCHsDerivingClause GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-634"></span><span>            </span><span class="annot"><span class="annottext">Maybe (LDerivStrategy GhcPs)
deriv_clause_strategy :: Maybe (LDerivStrategy GhcPs)
deriv_clause_strategy :: Maybe (LDerivStrategy GhcPs)
</span><a href="GHC.Hs.Decls.html#deriv_clause_strategy"><span class="hs-identifier hs-var hs-var">deriv_clause_strategy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-635"></span><span>            </span><span class="annot"><span class="annottext">deriv_clause_tys :: Located [LHsSigType GhcPs]
</span><a href="GHC.Hs.Decls.html#deriv_clause_tys"><span class="hs-identifier hs-var">deriv_clause_tys</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Located [LHsSigType GhcPs]
</span><a href="#local-6989586621680973888"><span class="hs-identifier hs-var">deriv_clause_tys'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-636"></span><span>
</span><span id="line-637"></span><span class="hs-comment">-- Process a single data constructor declaration, which may come in one of the</span><span>
</span><span id="line-638"></span><span class="hs-comment">-- following forms:</span><span>
</span><span id="line-639"></span><span class="hs-comment">--</span><span>
</span><span id="line-640"></span><span class="hs-comment">--    1. H98-syntax PrefixCon:</span><span>
</span><span id="line-641"></span><span class="hs-comment">--          data T =</span><span>
</span><span id="line-642"></span><span class="hs-comment">--            MkT    -- ^ Comment on MkT</span><span>
</span><span id="line-643"></span><span class="hs-comment">--              Int  -- ^ Comment on Int</span><span>
</span><span id="line-644"></span><span class="hs-comment">--              Bool -- ^ Comment on Bool</span><span>
</span><span id="line-645"></span><span class="hs-comment">--</span><span>
</span><span id="line-646"></span><span class="hs-comment">--    2. H98-syntax InfixCon:</span><span>
</span><span id="line-647"></span><span class="hs-comment">--          data T =</span><span>
</span><span id="line-648"></span><span class="hs-comment">--            Int   -- ^ Comment on Int</span><span>
</span><span id="line-649"></span><span class="hs-comment">--              :+  -- ^ Comment on (:+)</span><span>
</span><span id="line-650"></span><span class="hs-comment">--            Bool  -- ^ Comment on Bool</span><span>
</span><span id="line-651"></span><span class="hs-comment">--</span><span>
</span><span id="line-652"></span><span class="hs-comment">--    3. H98-syntax RecCon:</span><span>
</span><span id="line-653"></span><span class="hs-comment">--          data T =</span><span>
</span><span id="line-654"></span><span class="hs-comment">--            MkT { int_field :: Int,     -- ^ Comment on int_field</span><span>
</span><span id="line-655"></span><span class="hs-comment">--                  bool_field :: Bool }  -- ^ Comment on bool_field</span><span>
</span><span id="line-656"></span><span class="hs-comment">--</span><span>
</span><span id="line-657"></span><span class="hs-comment">--    4. GADT-syntax PrefixCon:</span><span>
</span><span id="line-658"></span><span class="hs-comment">--          data T where</span><span>
</span><span id="line-659"></span><span class="hs-comment">--            -- | Comment on MkT</span><span>
</span><span id="line-660"></span><span class="hs-comment">--            MkT :: Int  -- ^ Comment on Int</span><span>
</span><span id="line-661"></span><span class="hs-comment">--                -&gt; Bool -- ^ Comment on Bool</span><span>
</span><span id="line-662"></span><span class="hs-comment">--                -&gt; T</span><span>
</span><span id="line-663"></span><span class="hs-comment">--</span><span>
</span><span id="line-664"></span><span class="hs-comment">--    5. GADT-syntax RecCon:</span><span>
</span><span id="line-665"></span><span class="hs-comment">--          data T where</span><span>
</span><span id="line-666"></span><span class="hs-comment">--            -- | Comment on MkT</span><span>
</span><span id="line-667"></span><span class="hs-comment">--            MkT :: { int_field :: Int,     -- ^ Comment on int_field</span><span>
</span><span id="line-668"></span><span class="hs-comment">--                     bool_field :: Bool }  -- ^ Comment on bool_field</span><span>
</span><span id="line-669"></span><span class="hs-comment">--                -&gt; T</span><span>
</span><span id="line-670"></span><span class="hs-comment">--</span><span>
</span><span id="line-671"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#LConDecl"><span class="hs-identifier hs-type">LConDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-672"></span><span>  </span><span id="local-6989586621680973858"><span class="annot"><span class="annottext">addHaddock :: LConDecl GhcPs -&gt; HdkA (LConDecl GhcPs)
</span><a href="#local-6989586621680973858"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973857"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973857"><span class="hs-identifier hs-var">l_con_decl</span></a></span></span><span> </span><span id="local-6989586621680973856"><span class="annot"><span class="annottext">ConDecl GhcPs
</span><a href="#local-6989586621680973856"><span class="hs-identifier hs-var">con_decl</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-673"></span><span>    </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkA (LConDecl GhcPs) -&gt; HdkA (LConDecl GhcPs)
forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var">extendHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973857"><span class="hs-identifier hs-var">l_con_decl</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (LConDecl GhcPs) -&gt; HdkA (LConDecl GhcPs))
-&gt; HdkA (LConDecl GhcPs) -&gt; HdkA (LConDecl GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-674"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ConDecl GhcPs
</span><a href="#local-6989586621680973856"><span class="hs-identifier hs-var">con_decl</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-675"></span><span>      </span><span class="annot"><a href="GHC.Hs.Decls.html#ConDeclGADT"><span class="hs-identifier hs-type">ConDeclGADT</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680973854"><span class="annot"><span class="annottext">XConDeclGADT GhcPs
con_g_ext :: forall pass. ConDecl pass -&gt; XConDeclGADT pass
con_g_ext :: XConDeclGADT GhcPs
</span><a href="GHC.Hs.Decls.html#con_g_ext"><span class="hs-identifier hs-var hs-var">con_g_ext</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973852"><span class="annot"><span class="annottext">[Located (IdP GhcPs)]
con_names :: forall pass. ConDecl pass -&gt; [Located (IdP pass)]
con_names :: [Located (IdP GhcPs)]
</span><a href="GHC.Hs.Decls.html#con_names"><span class="hs-identifier hs-var hs-var">con_names</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973850"><span class="annot"><span class="annottext">Located Bool
con_forall :: forall pass. ConDecl pass -&gt; Located Bool
con_forall :: Located Bool
</span><a href="GHC.Hs.Decls.html#con_forall"><span class="hs-identifier hs-var hs-var">con_forall</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973848"><span class="annot"><span class="annottext">[LHsTyVarBndr Specificity GhcPs]
con_qvars :: forall pass. ConDecl pass -&gt; [LHsTyVarBndr Specificity pass]
con_qvars :: [LHsTyVarBndr Specificity GhcPs]
</span><a href="GHC.Hs.Decls.html#con_qvars"><span class="hs-identifier hs-var hs-var">con_qvars</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973846"><span class="annot"><span class="annottext">Maybe (LHsContext GhcPs)
con_mb_cxt :: forall pass. ConDecl pass -&gt; Maybe (LHsContext pass)
con_mb_cxt :: Maybe (LHsContext GhcPs)
</span><a href="GHC.Hs.Decls.html#con_mb_cxt"><span class="hs-identifier hs-var hs-var">con_mb_cxt</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973844"><span class="annot"><span class="annottext">HsConDeclDetails GhcPs
con_args :: forall pass. ConDecl pass -&gt; HsConDeclDetails pass
con_args :: HsConDeclDetails GhcPs
</span><a href="GHC.Hs.Decls.html#con_args"><span class="hs-identifier hs-var hs-var">con_args</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973842"><span class="annot"><span class="annottext">LHsType GhcPs
con_res_ty :: forall pass. ConDecl pass -&gt; LHsType pass
con_res_ty :: LHsType GhcPs
</span><a href="GHC.Hs.Decls.html#con_res_ty"><span class="hs-identifier hs-var hs-var">con_res_ty</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-676"></span><span>        </span><span class="hs-comment">-- discardHasInnerDocs is ok because we don't need this info for GADTs.</span><span>
</span><span id="line-677"></span><span>        </span><span id="local-6989586621680973840"><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973840"><span class="hs-identifier hs-var">con_doc'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ConHdkA (Maybe (GenLocated SrcSpan HsDocString))
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString))
forall a. ConHdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#discardHasInnerDocs"><span class="hs-identifier hs-var">discardHasInnerDocs</span></a></span><span> </span><span class="annot"><span class="annottext">(ConHdkA (Maybe (GenLocated SrcSpan HsDocString))
 -&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString)))
-&gt; ConHdkA (Maybe (GenLocated SrcSpan HsDocString))
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConHdkA (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#getConDoc"><span class="hs-identifier hs-var">getConDoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located RdrName -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Located RdrName] -&gt; Located RdrName
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#head"><span class="hs-identifier hs-var">head</span></a></span><span> </span><span class="annot"><span class="annottext">[Located RdrName]
[Located (IdP GhcPs)]
</span><a href="#local-6989586621680973852"><span class="hs-identifier hs-var">con_names</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-678"></span><span>        </span><span id="local-6989586621680973836"><span class="annot"><span class="annottext">HsConDeclDetails GhcPs
</span><a href="#local-6989586621680973836"><span class="hs-identifier hs-var">con_args'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-679"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HsConDeclDetails GhcPs
</span><a href="#local-6989586621680973844"><span class="hs-identifier hs-var">con_args</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-680"></span><span>            </span><span class="annot"><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-type">PrefixCon</span></a></span><span> </span><span id="local-6989586621680973834"><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)]
</span><a href="#local-6989586621680973834"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)] -&gt; HsConDeclDetails GhcPs
forall arg rec. [arg] -&gt; HsConDetails arg rec
</span><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-var">PrefixCon</span></a></span><span> </span><span class="annot"><span class="annottext">([HsScaled GhcPs (LHsType GhcPs)] -&gt; HsConDeclDetails GhcPs)
-&gt; HdkA [HsScaled GhcPs (LHsType GhcPs)]
-&gt; HdkA (HsConDeclDetails GhcPs)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)]
-&gt; HdkA [HsScaled GhcPs (LHsType GhcPs)]
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)]
</span><a href="#local-6989586621680973834"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-681"></span><span>            </span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973831"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973831"><span class="hs-identifier hs-var">l_rec</span></a></span></span><span> </span><span id="local-6989586621680973830"><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973830"><span class="hs-identifier hs-var">flds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-682"></span><span>              </span><span class="hs-comment">-- discardHasInnerDocs is ok because we don't need this info for GADTs.</span><span>
</span><span id="line-683"></span><span>              </span><span id="local-6989586621680973829"><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973829"><span class="hs-identifier hs-var">flds'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LConDeclField GhcPs -&gt; HdkA (LConDeclField GhcPs))
-&gt; [LConDeclField GhcPs] -&gt; HdkA [LConDeclField GhcPs]
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConHdkA (LConDeclField GhcPs) -&gt; HdkA (LConDeclField GhcPs)
forall a. ConHdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#discardHasInnerDocs"><span class="hs-identifier hs-var">discardHasInnerDocs</span></a></span><span> </span><span class="annot"><span class="annottext">(ConHdkA (LConDeclField GhcPs) -&gt; HdkA (LConDeclField GhcPs))
-&gt; (LConDeclField GhcPs -&gt; ConHdkA (LConDeclField GhcPs))
-&gt; LConDeclField GhcPs
-&gt; HdkA (LConDeclField GhcPs)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LConDeclField GhcPs -&gt; ConHdkA (LConDeclField GhcPs)
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockConDeclField"><span class="hs-identifier hs-var">addHaddockConDeclField</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973830"><span class="hs-identifier hs-var">flds</span></a></span><span>
</span><span id="line-684"></span><span>              </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan [LConDeclField GhcPs] -&gt; HsConDeclDetails GhcPs
forall arg rec. rec -&gt; HsConDetails arg rec
</span><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-var">RecCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan
-&gt; [LConDeclField GhcPs]
-&gt; GenLocated SrcSpan [LConDeclField GhcPs]
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973831"><span class="hs-identifier hs-var">l_rec</span></a></span><span> </span><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973829"><span class="hs-identifier hs-var">flds'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-685"></span><span>            </span><span class="annot"><a href="GHC.Hs.Type.html#InfixCon"><span class="hs-identifier hs-type">InfixCon</span></a></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; HdkA (HsConDeclDetails GhcPs)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ConDeclGADT InfixCon&quot;</span></span><span>
</span><span id="line-686"></span><span>        </span><span id="local-6989586621680973824"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973824"><span class="hs-identifier hs-var">con_res_ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs -&gt; HdkA (LHsType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973842"><span class="hs-identifier hs-var">con_res_ty</span></a></span><span>
</span><span id="line-687"></span><span>        </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConDecl GhcPs -&gt; LConDecl GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973857"><span class="hs-identifier hs-var">l_con_decl</span></a></span><span> </span><span class="annot"><span class="annottext">(ConDecl GhcPs -&gt; LConDecl GhcPs)
-&gt; ConDecl GhcPs -&gt; LConDecl GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-688"></span><span>          </span><span class="annot"><span class="annottext">ConDeclGADT :: forall pass.
XConDeclGADT pass
-&gt; [Located (IdP pass)]
-&gt; Located Bool
-&gt; [LHsTyVarBndr Specificity pass]
-&gt; Maybe (LHsContext pass)
-&gt; HsConDeclDetails pass
-&gt; LHsType pass
-&gt; Maybe (GenLocated SrcSpan HsDocString)
-&gt; ConDecl pass
</span><a href="GHC.Hs.Decls.html#ConDeclGADT"><span class="hs-identifier hs-type">ConDeclGADT</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">XConDeclGADT GhcPs
con_g_ext :: XConDeclGADT GhcPs
con_g_ext :: XConDeclGADT GhcPs
</span><a href="GHC.Hs.Decls.html#con_g_ext"><span class="hs-identifier hs-var hs-var">con_g_ext</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Located (IdP GhcPs)]
con_names :: [Located (IdP GhcPs)]
con_names :: [Located (IdP GhcPs)]
</span><a href="GHC.Hs.Decls.html#con_names"><span class="hs-identifier hs-var hs-var">con_names</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located Bool
con_forall :: Located Bool
con_forall :: Located Bool
</span><a href="GHC.Hs.Decls.html#con_forall"><span class="hs-identifier hs-var hs-var">con_forall</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LHsTyVarBndr Specificity GhcPs]
con_qvars :: [LHsTyVarBndr Specificity GhcPs]
con_qvars :: [LHsTyVarBndr Specificity GhcPs]
</span><a href="GHC.Hs.Decls.html#con_qvars"><span class="hs-identifier hs-var hs-var">con_qvars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (LHsContext GhcPs)
con_mb_cxt :: Maybe (LHsContext GhcPs)
con_mb_cxt :: Maybe (LHsContext GhcPs)
</span><a href="GHC.Hs.Decls.html#con_mb_cxt"><span class="hs-identifier hs-var hs-var">con_mb_cxt</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-689"></span><span>                        </span><span class="annot"><span class="annottext">con_doc :: Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Hs.Decls.html#con_doc"><span class="hs-identifier hs-var">con_doc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973840"><span class="hs-identifier hs-var">con_doc'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-690"></span><span>                        </span><span class="annot"><span class="annottext">con_args :: HsConDeclDetails GhcPs
</span><a href="GHC.Hs.Decls.html#con_args"><span class="hs-identifier hs-var">con_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsConDeclDetails GhcPs
</span><a href="#local-6989586621680973836"><span class="hs-identifier hs-var">con_args'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-691"></span><span>                        </span><span class="annot"><span class="annottext">con_res_ty :: LHsType GhcPs
</span><a href="GHC.Hs.Decls.html#con_res_ty"><span class="hs-identifier hs-var">con_res_ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973824"><span class="hs-identifier hs-var">con_res_ty'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-692"></span><span>      </span><span class="annot"><a href="GHC.Hs.Decls.html#ConDeclH98"><span class="hs-identifier hs-type">ConDeclH98</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680973821"><span class="annot"><span class="annottext">XConDeclH98 GhcPs
con_ext :: forall pass. ConDecl pass -&gt; XConDeclH98 pass
con_ext :: XConDeclH98 GhcPs
</span><a href="GHC.Hs.Decls.html#con_ext"><span class="hs-identifier hs-var hs-var">con_ext</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973819"><span class="annot"><span class="annottext">Located (IdP GhcPs)
con_name :: forall pass. ConDecl pass -&gt; Located (IdP pass)
con_name :: Located (IdP GhcPs)
</span><a href="GHC.Hs.Decls.html#con_name"><span class="hs-identifier hs-var hs-var">con_name</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973817"><span class="annot"><span class="annottext">Located Bool
con_forall :: Located Bool
con_forall :: forall pass. ConDecl pass -&gt; Located Bool
</span><a href="#local-6989586621680973817"><span class="hs-identifier hs-var hs-var">con_forall</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973816"><span class="annot"><span class="annottext">[LHsTyVarBndr Specificity GhcPs]
con_ex_tvs :: forall pass. ConDecl pass -&gt; [LHsTyVarBndr Specificity pass]
con_ex_tvs :: [LHsTyVarBndr Specificity GhcPs]
</span><a href="GHC.Hs.Decls.html#con_ex_tvs"><span class="hs-identifier hs-var hs-var">con_ex_tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973814"><span class="annot"><span class="annottext">Maybe (LHsContext GhcPs)
con_mb_cxt :: Maybe (LHsContext GhcPs)
con_mb_cxt :: forall pass. ConDecl pass -&gt; Maybe (LHsContext pass)
</span><a href="#local-6989586621680973814"><span class="hs-identifier hs-var hs-var">con_mb_cxt</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973813"><span class="annot"><span class="annottext">HsConDeclDetails GhcPs
con_args :: HsConDeclDetails GhcPs
con_args :: forall pass. ConDecl pass -&gt; HsConDeclDetails pass
</span><a href="#local-6989586621680973813"><span class="hs-identifier hs-var hs-var">con_args</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-693"></span><span>        </span><span class="annot"><span class="annottext">SrcLoc -&gt; ConHdkA (LConDecl GhcPs) -&gt; HdkA (LConDecl GhcPs)
</span><a href="GHC.Parser.PostProcess.Haddock.html#addConTrailingDoc"><span class="hs-identifier hs-var">addConTrailingDoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcLoc
</span><a href="GHC.Types.SrcLoc.html#srcSpanEnd"><span class="hs-identifier hs-var">srcSpanEnd</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973857"><span class="hs-identifier hs-var">l_con_decl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(ConHdkA (LConDecl GhcPs) -&gt; HdkA (LConDecl GhcPs))
-&gt; ConHdkA (LConDecl GhcPs) -&gt; HdkA (LConDecl GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-694"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HsConDeclDetails GhcPs
</span><a href="#local-6989586621680973813"><span class="hs-identifier hs-var">con_args</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-695"></span><span>          </span><span class="annot"><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-type">PrefixCon</span></a></span><span> </span><span id="local-6989586621680973811"><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)]
</span><a href="#local-6989586621680973811"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-696"></span><span>            </span><span id="local-6989586621680973810"><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973810"><span class="hs-identifier hs-var">con_doc'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConHdkA (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#getConDoc"><span class="hs-identifier hs-var">getConDoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located RdrName -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located RdrName
Located (IdP GhcPs)
</span><a href="#local-6989586621680973819"><span class="hs-identifier hs-var">con_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-697"></span><span>            </span><span id="local-6989586621680973809"><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)]
</span><a href="#local-6989586621680973809"><span class="hs-identifier hs-var">ts'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(HsScaled GhcPs (LHsType GhcPs)
 -&gt; WriterT HasInnerDocs HdkA (HsScaled GhcPs (LHsType GhcPs)))
-&gt; [HsScaled GhcPs (LHsType GhcPs)]
-&gt; WriterT HasInnerDocs HdkA [HsScaled GhcPs (LHsType GhcPs)]
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
-&gt; WriterT HasInnerDocs HdkA (HsScaled GhcPs (LHsType GhcPs))
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockConDeclFieldTy"><span class="hs-identifier hs-var">addHaddockConDeclFieldTy</span></a></span><span> </span><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)]
</span><a href="#local-6989586621680973811"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-698"></span><span>            </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConDecl GhcPs -&gt; LConDecl GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973857"><span class="hs-identifier hs-var">l_con_decl</span></a></span><span> </span><span class="annot"><span class="annottext">(ConDecl GhcPs -&gt; LConDecl GhcPs)
-&gt; ConDecl GhcPs -&gt; LConDecl GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-699"></span><span>              </span><span class="annot"><span class="annottext">ConDeclH98 :: forall pass.
XConDeclH98 pass
-&gt; Located (IdP pass)
-&gt; Located Bool
-&gt; [LHsTyVarBndr Specificity pass]
-&gt; Maybe (LHsContext pass)
-&gt; HsConDeclDetails pass
-&gt; Maybe (GenLocated SrcSpan HsDocString)
-&gt; ConDecl pass
</span><a href="GHC.Hs.Decls.html#ConDeclH98"><span class="hs-identifier hs-type">ConDeclH98</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">XConDeclH98 GhcPs
con_ext :: XConDeclH98 GhcPs
con_ext :: XConDeclH98 GhcPs
</span><a href="GHC.Hs.Decls.html#con_ext"><span class="hs-identifier hs-var hs-var">con_ext</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located (IdP GhcPs)
con_name :: Located (IdP GhcPs)
con_name :: Located (IdP GhcPs)
</span><a href="GHC.Hs.Decls.html#con_name"><span class="hs-identifier hs-var hs-var">con_name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located Bool
con_forall :: Located Bool
con_forall :: Located Bool
</span><a href="#local-6989586621680973817"><span class="hs-identifier hs-var hs-var">con_forall</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LHsTyVarBndr Specificity GhcPs]
con_ex_tvs :: [LHsTyVarBndr Specificity GhcPs]
con_ex_tvs :: [LHsTyVarBndr Specificity GhcPs]
</span><a href="GHC.Hs.Decls.html#con_ex_tvs"><span class="hs-identifier hs-var hs-var">con_ex_tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (LHsContext GhcPs)
con_mb_cxt :: Maybe (LHsContext GhcPs)
con_mb_cxt :: Maybe (LHsContext GhcPs)
</span><a href="#local-6989586621680973814"><span class="hs-identifier hs-var hs-var">con_mb_cxt</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-700"></span><span>                           </span><span class="annot"><span class="annottext">con_doc :: Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Hs.Decls.html#con_doc"><span class="hs-identifier hs-var">con_doc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973810"><span class="hs-identifier hs-var">con_doc'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-701"></span><span>                           </span><span class="annot"><span class="annottext">con_args :: HsConDeclDetails GhcPs
</span><a href="GHC.Hs.Decls.html#con_args"><span class="hs-identifier hs-var">con_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)] -&gt; HsConDeclDetails GhcPs
forall arg rec. [arg] -&gt; HsConDetails arg rec
</span><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-var">PrefixCon</span></a></span><span> </span><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)]
</span><a href="#local-6989586621680973809"><span class="hs-identifier hs-var">ts'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-702"></span><span>          </span><span class="annot"><a href="GHC.Hs.Type.html#InfixCon"><span class="hs-identifier hs-type">InfixCon</span></a></span><span> </span><span id="local-6989586621680973807"><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973807"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621680973806"><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973806"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-703"></span><span>            </span><span id="local-6989586621680973805"><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973805"><span class="hs-identifier hs-var">t1'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
-&gt; WriterT HasInnerDocs HdkA (HsScaled GhcPs (LHsType GhcPs))
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockConDeclFieldTy"><span class="hs-identifier hs-var">addHaddockConDeclFieldTy</span></a></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973807"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-704"></span><span>            </span><span id="local-6989586621680973804"><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973804"><span class="hs-identifier hs-var">con_doc'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConHdkA (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#getConDoc"><span class="hs-identifier hs-var">getConDoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located RdrName -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located RdrName
Located (IdP GhcPs)
</span><a href="#local-6989586621680973819"><span class="hs-identifier hs-var">con_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-705"></span><span>            </span><span id="local-6989586621680973803"><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973803"><span class="hs-identifier hs-var">t2'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
-&gt; WriterT HasInnerDocs HdkA (HsScaled GhcPs (LHsType GhcPs))
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockConDeclFieldTy"><span class="hs-identifier hs-var">addHaddockConDeclFieldTy</span></a></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973806"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-706"></span><span>            </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConDecl GhcPs -&gt; LConDecl GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973857"><span class="hs-identifier hs-var">l_con_decl</span></a></span><span> </span><span class="annot"><span class="annottext">(ConDecl GhcPs -&gt; LConDecl GhcPs)
-&gt; ConDecl GhcPs -&gt; LConDecl GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-707"></span><span>              </span><span class="annot"><span class="annottext">ConDeclH98 :: forall pass.
XConDeclH98 pass
-&gt; Located (IdP pass)
-&gt; Located Bool
-&gt; [LHsTyVarBndr Specificity pass]
-&gt; Maybe (LHsContext pass)
-&gt; HsConDeclDetails pass
-&gt; Maybe (GenLocated SrcSpan HsDocString)
-&gt; ConDecl pass
</span><a href="GHC.Hs.Decls.html#ConDeclH98"><span class="hs-identifier hs-type">ConDeclH98</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">XConDeclH98 GhcPs
con_ext :: XConDeclH98 GhcPs
con_ext :: XConDeclH98 GhcPs
</span><a href="GHC.Hs.Decls.html#con_ext"><span class="hs-identifier hs-var hs-var">con_ext</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located (IdP GhcPs)
con_name :: Located (IdP GhcPs)
con_name :: Located (IdP GhcPs)
</span><a href="GHC.Hs.Decls.html#con_name"><span class="hs-identifier hs-var hs-var">con_name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located Bool
con_forall :: Located Bool
con_forall :: Located Bool
</span><a href="#local-6989586621680973817"><span class="hs-identifier hs-var hs-var">con_forall</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LHsTyVarBndr Specificity GhcPs]
con_ex_tvs :: [LHsTyVarBndr Specificity GhcPs]
con_ex_tvs :: [LHsTyVarBndr Specificity GhcPs]
</span><a href="GHC.Hs.Decls.html#con_ex_tvs"><span class="hs-identifier hs-var hs-var">con_ex_tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (LHsContext GhcPs)
con_mb_cxt :: Maybe (LHsContext GhcPs)
con_mb_cxt :: Maybe (LHsContext GhcPs)
</span><a href="#local-6989586621680973814"><span class="hs-identifier hs-var hs-var">con_mb_cxt</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-708"></span><span>                           </span><span class="annot"><span class="annottext">con_doc :: Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Hs.Decls.html#con_doc"><span class="hs-identifier hs-var">con_doc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973804"><span class="hs-identifier hs-var">con_doc'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-709"></span><span>                           </span><span class="annot"><span class="annottext">con_args :: HsConDeclDetails GhcPs
</span><a href="GHC.Hs.Decls.html#con_args"><span class="hs-identifier hs-var">con_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
-&gt; HsScaled GhcPs (LHsType GhcPs) -&gt; HsConDeclDetails GhcPs
forall arg rec. arg -&gt; arg -&gt; HsConDetails arg rec
</span><a href="GHC.Hs.Type.html#InfixCon"><span class="hs-identifier hs-var">InfixCon</span></a></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973805"><span class="hs-identifier hs-var">t1'</span></a></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973803"><span class="hs-identifier hs-var">t2'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-710"></span><span>          </span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973802"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973802"><span class="hs-identifier hs-var">l_rec</span></a></span></span><span> </span><span id="local-6989586621680973801"><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973801"><span class="hs-identifier hs-var">flds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-711"></span><span>            </span><span id="local-6989586621680973800"><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973800"><span class="hs-identifier hs-var">con_doc'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConHdkA (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#getConDoc"><span class="hs-identifier hs-var">getConDoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located RdrName -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located RdrName
Located (IdP GhcPs)
</span><a href="#local-6989586621680973819"><span class="hs-identifier hs-var">con_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-712"></span><span>            </span><span id="local-6989586621680973799"><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973799"><span class="hs-identifier hs-var">flds'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LConDeclField GhcPs -&gt; ConHdkA (LConDeclField GhcPs))
-&gt; [LConDeclField GhcPs]
-&gt; WriterT HasInnerDocs HdkA [LConDeclField GhcPs]
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="annot"><span class="annottext">LConDeclField GhcPs -&gt; ConHdkA (LConDeclField GhcPs)
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockConDeclField"><span class="hs-identifier hs-var">addHaddockConDeclField</span></a></span><span> </span><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973801"><span class="hs-identifier hs-var">flds</span></a></span><span>
</span><span id="line-713"></span><span>            </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConDecl GhcPs -&gt; LConDecl GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973857"><span class="hs-identifier hs-var">l_con_decl</span></a></span><span> </span><span class="annot"><span class="annottext">(ConDecl GhcPs -&gt; LConDecl GhcPs)
-&gt; ConDecl GhcPs -&gt; LConDecl GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-714"></span><span>              </span><span class="annot"><span class="annottext">ConDeclH98 :: forall pass.
XConDeclH98 pass
-&gt; Located (IdP pass)
-&gt; Located Bool
-&gt; [LHsTyVarBndr Specificity pass]
-&gt; Maybe (LHsContext pass)
-&gt; HsConDeclDetails pass
-&gt; Maybe (GenLocated SrcSpan HsDocString)
-&gt; ConDecl pass
</span><a href="GHC.Hs.Decls.html#ConDeclH98"><span class="hs-identifier hs-type">ConDeclH98</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">XConDeclH98 GhcPs
con_ext :: XConDeclH98 GhcPs
con_ext :: XConDeclH98 GhcPs
</span><a href="GHC.Hs.Decls.html#con_ext"><span class="hs-identifier hs-var hs-var">con_ext</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located (IdP GhcPs)
con_name :: Located (IdP GhcPs)
con_name :: Located (IdP GhcPs)
</span><a href="GHC.Hs.Decls.html#con_name"><span class="hs-identifier hs-var hs-var">con_name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located Bool
con_forall :: Located Bool
con_forall :: Located Bool
</span><a href="#local-6989586621680973817"><span class="hs-identifier hs-var hs-var">con_forall</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[LHsTyVarBndr Specificity GhcPs]
con_ex_tvs :: [LHsTyVarBndr Specificity GhcPs]
con_ex_tvs :: [LHsTyVarBndr Specificity GhcPs]
</span><a href="GHC.Hs.Decls.html#con_ex_tvs"><span class="hs-identifier hs-var hs-var">con_ex_tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (LHsContext GhcPs)
con_mb_cxt :: Maybe (LHsContext GhcPs)
con_mb_cxt :: Maybe (LHsContext GhcPs)
</span><a href="#local-6989586621680973814"><span class="hs-identifier hs-var hs-var">con_mb_cxt</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-715"></span><span>                           </span><span class="annot"><span class="annottext">con_doc :: Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Hs.Decls.html#con_doc"><span class="hs-identifier hs-var">con_doc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973800"><span class="hs-identifier hs-var">con_doc'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-716"></span><span>                           </span><span class="annot"><span class="annottext">con_args :: HsConDeclDetails GhcPs
</span><a href="GHC.Hs.Decls.html#con_args"><span class="hs-identifier hs-var">con_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan [LConDeclField GhcPs] -&gt; HsConDeclDetails GhcPs
forall arg rec. rec -&gt; HsConDetails arg rec
</span><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-var">RecCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan
-&gt; [LConDeclField GhcPs]
-&gt; GenLocated SrcSpan [LConDeclField GhcPs]
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973802"><span class="hs-identifier hs-var">l_rec</span></a></span><span> </span><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973799"><span class="hs-identifier hs-var">flds'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-717"></span><span>
</span><span id="line-718"></span><span class="hs-comment">-- Keep track of documentation comments on the data constructor or any of its</span><span>
</span><span id="line-719"></span><span class="hs-comment">-- fields.</span><span>
</span><span id="line-720"></span><span class="hs-comment">--</span><span>
</span><span id="line-721"></span><span class="hs-comment">-- See Note [Trailing comment on constructor declaration]</span><span>
</span><span id="line-722"></span><span class="hs-keyword">type</span><span> </span><span id="ConHdkA"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ConHdkA"><span class="hs-identifier hs-var">ConHdkA</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.Writer.Lazy.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasInnerDocs"><span class="hs-identifier hs-type">HasInnerDocs</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span>
</span><span id="line-723"></span><span>
</span><span id="line-724"></span><span class="hs-comment">-- Does the data constructor declaration have any inner (non-trailing)</span><span>
</span><span id="line-725"></span><span class="hs-comment">-- documentation comments?</span><span>
</span><span id="line-726"></span><span class="hs-comment">--</span><span>
</span><span id="line-727"></span><span class="hs-comment">-- Example when HasInnerDocs is True:</span><span>
</span><span id="line-728"></span><span class="hs-comment">--</span><span>
</span><span id="line-729"></span><span class="hs-comment">--   data X =</span><span>
</span><span id="line-730"></span><span class="hs-comment">--      MkX       -- ^ inner comment</span><span>
</span><span id="line-731"></span><span class="hs-comment">--        Field1  -- ^ inner comment</span><span>
</span><span id="line-732"></span><span class="hs-comment">--        Field2  -- ^ inner comment</span><span>
</span><span id="line-733"></span><span class="hs-comment">--        Field3  -- ^ trailing comment</span><span>
</span><span id="line-734"></span><span class="hs-comment">--</span><span>
</span><span id="line-735"></span><span class="hs-comment">-- Example when HasInnerDocs is False:</span><span>
</span><span id="line-736"></span><span class="hs-comment">--</span><span>
</span><span id="line-737"></span><span class="hs-comment">--   data Y = MkY Field1 Field2 Field3  -- ^ trailing comment</span><span>
</span><span id="line-738"></span><span class="hs-comment">--</span><span>
</span><span id="line-739"></span><span class="hs-comment">-- See Note [Trailing comment on constructor declaration]</span><span>
</span><span id="line-740"></span><span class="hs-keyword">newtype</span><span> </span><span id="HasInnerDocs"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasInnerDocs"><span class="hs-identifier hs-var">HasInnerDocs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="HasInnerDocs"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasInnerDocs"><span class="hs-identifier hs-var">HasInnerDocs</span></a></span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-741"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680973785"><span id="local-6989586621680973791"><span id="local-6989586621680973796"><span class="annot"><span class="annottext">NonEmpty HasInnerDocs -&gt; HasInnerDocs
HasInnerDocs -&gt; HasInnerDocs -&gt; HasInnerDocs
(HasInnerDocs -&gt; HasInnerDocs -&gt; HasInnerDocs)
-&gt; (NonEmpty HasInnerDocs -&gt; HasInnerDocs)
-&gt; (forall b. Integral b =&gt; b -&gt; HasInnerDocs -&gt; HasInnerDocs)
-&gt; Semigroup HasInnerDocs
forall b. Integral b =&gt; b -&gt; HasInnerDocs -&gt; HasInnerDocs
forall a.
(a -&gt; a -&gt; a)
-&gt; (NonEmpty a -&gt; a)
-&gt; (forall b. Integral b =&gt; b -&gt; a -&gt; a)
-&gt; Semigroup a
stimes :: forall b. Integral b =&gt; b -&gt; HasInnerDocs -&gt; HasInnerDocs
$cstimes :: forall b. Integral b =&gt; b -&gt; HasInnerDocs -&gt; HasInnerDocs
sconcat :: NonEmpty HasInnerDocs -&gt; HasInnerDocs
$csconcat :: NonEmpty HasInnerDocs -&gt; HasInnerDocs
&lt;&gt; :: HasInnerDocs -&gt; HasInnerDocs -&gt; HasInnerDocs
$c&lt;&gt; :: HasInnerDocs -&gt; HasInnerDocs -&gt; HasInnerDocs
</span><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Semigroup</span></a></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973766"><span id="local-6989586621680973770"><span id="local-6989586621680973775"><span class="annot"><span class="annottext">Semigroup HasInnerDocs
HasInnerDocs
Semigroup HasInnerDocs
-&gt; HasInnerDocs
-&gt; (HasInnerDocs -&gt; HasInnerDocs -&gt; HasInnerDocs)
-&gt; ([HasInnerDocs] -&gt; HasInnerDocs)
-&gt; Monoid HasInnerDocs
[HasInnerDocs] -&gt; HasInnerDocs
HasInnerDocs -&gt; HasInnerDocs -&gt; HasInnerDocs
forall a.
Semigroup a -&gt; a -&gt; (a -&gt; a -&gt; a) -&gt; ([a] -&gt; a) -&gt; Monoid a
mconcat :: [HasInnerDocs] -&gt; HasInnerDocs
$cmconcat :: [HasInnerDocs] -&gt; HasInnerDocs
mappend :: HasInnerDocs -&gt; HasInnerDocs -&gt; HasInnerDocs
$cmappend :: HasInnerDocs -&gt; HasInnerDocs -&gt; HasInnerDocs
mempty :: HasInnerDocs
$cmempty :: HasInnerDocs
</span><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Monoid</span></a></span></span></span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">via</span><span> </span><span class="annot"><a href="../../base/src/Data.Semigroup.Internal.html#Any"><span class="hs-identifier hs-type">Data.Monoid.Any</span></a></span><span>
</span><span id="line-742"></span><span>
</span><span id="line-743"></span><span class="hs-comment">-- Run ConHdkA by discarding the HasInnerDocs info when we have no use for it.</span><span>
</span><span id="line-744"></span><span class="hs-comment">--</span><span>
</span><span id="line-745"></span><span class="hs-comment">-- We only do this when processing data declarations that use GADT syntax,</span><span>
</span><span id="line-746"></span><span class="hs-comment">-- because only the H98 syntax declarations have special treatment for the</span><span>
</span><span id="line-747"></span><span class="hs-comment">-- trailing documentation comment.</span><span>
</span><span id="line-748"></span><span class="hs-comment">--</span><span>
</span><span id="line-749"></span><span class="hs-comment">-- See Note [Trailing comment on constructor declaration]</span><span>
</span><span id="line-750"></span><span id="local-6989586621680974501"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#discardHasInnerDocs"><span class="hs-identifier hs-type">discardHasInnerDocs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ConHdkA"><span class="hs-identifier hs-type">ConHdkA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974501"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974501"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-751"></span><span id="discardHasInnerDocs"><span class="annot"><span class="annottext">discardHasInnerDocs :: forall a. ConHdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#discardHasInnerDocs"><span class="hs-identifier hs-var hs-var">discardHasInnerDocs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((a, HasInnerDocs) -&gt; a) -&gt; HdkA (a, HasInnerDocs) -&gt; HdkA a
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">(a, HasInnerDocs) -&gt; a
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (a, HasInnerDocs) -&gt; HdkA a)
-&gt; (WriterT HasInnerDocs HdkA a -&gt; HdkA (a, HasInnerDocs))
-&gt; WriterT HasInnerDocs HdkA a
-&gt; HdkA a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">WriterT HasInnerDocs HdkA a -&gt; HdkA (a, HasInnerDocs)
forall w (m :: * -&gt; *) a. WriterT w m a -&gt; m (a, w)
</span><a href="../../transformers/src/Control.Monad.Trans.Writer.Lazy.html#runWriterT"><span class="hs-identifier hs-var hs-var">runWriterT</span></a></span><span>
</span><span id="line-752"></span><span>
</span><span id="line-753"></span><span class="hs-comment">-- Get the documentation comment associated with the data constructor in a</span><span>
</span><span id="line-754"></span><span class="hs-comment">-- data/newtype declaration.</span><span>
</span><span id="line-755"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#getConDoc"><span class="hs-identifier hs-type">getConDoc</span></a></span><span>
</span><span id="line-756"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span>  </span><span class="hs-comment">-- Location of the data constructor</span><span>
</span><span id="line-757"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ConHdkA"><span class="hs-identifier hs-type">ConHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Doc.html#LHsDocString"><span class="hs-identifier hs-type">LHsDocString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-758"></span><span id="getConDoc"><span class="annot"><span class="annottext">getConDoc :: SrcSpan -&gt; ConHdkA (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#getConDoc"><span class="hs-identifier hs-var hs-var">getConDoc</span></a></span></span><span> </span><span id="local-6989586621680973759"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973759"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-759"></span><span>  </span><span class="annot"><span class="annottext">HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
-&gt; ConHdkA (Maybe (GenLocated SrcSpan HsDocString))
forall w (m :: * -&gt; *) a. m (a, w) -&gt; WriterT w m a
</span><a href="../../transformers/src/Control.Monad.Trans.Writer.Lazy.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
 -&gt; ConHdkA (Maybe (GenLocated SrcSpan HsDocString)))
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
-&gt; ConHdkA (Maybe (GenLocated SrcSpan HsDocString))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var">extendHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973759"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
 -&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs))
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HdkM (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
forall a. HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#liftHdkA"><span class="hs-identifier hs-var">liftHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkM (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
 -&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs))
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
-&gt; HdkA (Maybe (GenLocated SrcSpan HsDocString), HasInnerDocs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-760"></span><span>    </span><span id="local-6989586621680973757"><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973757"><span class="hs-identifier hs-var">mDoc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#getPrevNextDoc"><span class="hs-identifier hs-var">getPrevNextDoc</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973759"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-761"></span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973757"><span class="hs-identifier hs-var">mDoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; HasInnerDocs
</span><a href="GHC.Parser.PostProcess.Haddock.html#HasInnerDocs"><span class="hs-identifier hs-var">HasInnerDocs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString) -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier hs-var">isJust</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973757"><span class="hs-identifier hs-var">mDoc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-762"></span><span>
</span><span id="line-763"></span><span class="hs-comment">-- Add documentation comment to a data constructor field.</span><span>
</span><span id="line-764"></span><span class="hs-comment">-- Used for PrefixCon and InfixCon.</span><span>
</span><span id="line-765"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockConDeclFieldTy"><span class="hs-identifier hs-type">addHaddockConDeclFieldTy</span></a></span><span>
</span><span id="line-766"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-type">HsScaled</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#LHsType"><span class="hs-identifier hs-type">LHsType</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-767"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ConHdkA"><span class="hs-identifier hs-type">ConHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-type">HsScaled</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#LHsType"><span class="hs-identifier hs-type">LHsType</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-768"></span><span id="addHaddockConDeclFieldTy"><span class="annot"><span class="annottext">addHaddockConDeclFieldTy :: HsScaled GhcPs (LHsType GhcPs)
-&gt; WriterT HasInnerDocs HdkA (HsScaled GhcPs (LHsType GhcPs))
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockConDeclFieldTy"><span class="hs-identifier hs-var hs-var">addHaddockConDeclFieldTy</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-type">HsScaled</span></a></span><span> </span><span id="local-6989586621680973753"><span class="annot"><span class="annottext">HsArrow GhcPs
</span><a href="#local-6989586621680973753"><span class="hs-identifier hs-var">mult</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973752"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973752"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621680973751"><span class="annot"><span class="annottext">HsType GhcPs
</span><a href="#local-6989586621680973751"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-769"></span><span>  </span><span class="annot"><span class="annottext">HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
-&gt; WriterT HasInnerDocs HdkA (HsScaled GhcPs (LHsType GhcPs))
forall w (m :: * -&gt; *) a. m (a, w) -&gt; WriterT w m a
</span><a href="../../transformers/src/Control.Monad.Trans.Writer.Lazy.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
 -&gt; WriterT HasInnerDocs HdkA (HsScaled GhcPs (LHsType GhcPs)))
-&gt; HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
-&gt; WriterT HasInnerDocs HdkA (HsScaled GhcPs (LHsType GhcPs))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
-&gt; HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var">extendHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973752"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
 -&gt; HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs))
-&gt; HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
-&gt; HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HdkM (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
-&gt; HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
forall a. HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#liftHdkA"><span class="hs-identifier hs-var">liftHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkM (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
 -&gt; HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs))
-&gt; HdkM (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
-&gt; HdkA (HsScaled GhcPs (LHsType GhcPs), HasInnerDocs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-770"></span><span>    </span><span id="local-6989586621680973750"><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973750"><span class="hs-identifier hs-var">mDoc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#getPrevNextDoc"><span class="hs-identifier hs-var">getPrevNextDoc</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973752"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-771"></span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsArrow GhcPs -&gt; LHsType GhcPs -&gt; HsScaled GhcPs (LHsType GhcPs)
forall pass a. HsArrow pass -&gt; a -&gt; HsScaled pass a
</span><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-var">HsScaled</span></a></span><span> </span><span class="annot"><span class="annottext">HsArrow GhcPs
</span><a href="#local-6989586621680973753"><span class="hs-identifier hs-var">mult</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsType GhcPs
-&gt; Maybe (GenLocated SrcSpan HsDocString) -&gt; LHsType GhcPs
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkLHsDocTy"><span class="hs-identifier hs-var">mkLHsDocTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; HsType GhcPs -&gt; LHsType GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973752"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">HsType GhcPs
</span><a href="#local-6989586621680973751"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973750"><span class="hs-identifier hs-var">mDoc</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-772"></span><span>            </span><span class="annot"><span class="annottext">Bool -&gt; HasInnerDocs
</span><a href="GHC.Parser.PostProcess.Haddock.html#HasInnerDocs"><span class="hs-identifier hs-var">HasInnerDocs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString) -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier hs-var">isJust</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973750"><span class="hs-identifier hs-var">mDoc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-773"></span><span>
</span><span id="line-774"></span><span class="hs-comment">-- Add documentation comment to a data constructor field.</span><span>
</span><span id="line-775"></span><span class="hs-comment">-- Used for RecCon.</span><span>
</span><span id="line-776"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockConDeclField"><span class="hs-identifier hs-type">addHaddockConDeclField</span></a></span><span>
</span><span id="line-777"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#LConDeclField"><span class="hs-identifier hs-type">LConDeclField</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-778"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ConHdkA"><span class="hs-identifier hs-type">ConHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#LConDeclField"><span class="hs-identifier hs-type">LConDeclField</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-779"></span><span id="addHaddockConDeclField"><span class="annot"><span class="annottext">addHaddockConDeclField :: LConDeclField GhcPs -&gt; ConHdkA (LConDeclField GhcPs)
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddockConDeclField"><span class="hs-identifier hs-var hs-var">addHaddockConDeclField</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973748"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973748"><span class="hs-identifier hs-var">l_fld</span></a></span></span><span> </span><span id="local-6989586621680973747"><span class="annot"><span class="annottext">ConDeclField GhcPs
</span><a href="#local-6989586621680973747"><span class="hs-identifier hs-var">fld</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-780"></span><span>  </span><span class="annot"><span class="annottext">HdkA (LConDeclField GhcPs, HasInnerDocs)
-&gt; ConHdkA (LConDeclField GhcPs)
forall w (m :: * -&gt; *) a. m (a, w) -&gt; WriterT w m a
</span><a href="../../transformers/src/Control.Monad.Trans.Writer.Lazy.html#WriterT"><span class="hs-identifier hs-var">WriterT</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (LConDeclField GhcPs, HasInnerDocs)
 -&gt; ConHdkA (LConDeclField GhcPs))
-&gt; HdkA (LConDeclField GhcPs, HasInnerDocs)
-&gt; ConHdkA (LConDeclField GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; HdkA (LConDeclField GhcPs, HasInnerDocs)
-&gt; HdkA (LConDeclField GhcPs, HasInnerDocs)
forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var">extendHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973748"><span class="hs-identifier hs-var">l_fld</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (LConDeclField GhcPs, HasInnerDocs)
 -&gt; HdkA (LConDeclField GhcPs, HasInnerDocs))
-&gt; HdkA (LConDeclField GhcPs, HasInnerDocs)
-&gt; HdkA (LConDeclField GhcPs, HasInnerDocs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HdkM (LConDeclField GhcPs, HasInnerDocs)
-&gt; HdkA (LConDeclField GhcPs, HasInnerDocs)
forall a. HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#liftHdkA"><span class="hs-identifier hs-var">liftHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkM (LConDeclField GhcPs, HasInnerDocs)
 -&gt; HdkA (LConDeclField GhcPs, HasInnerDocs))
-&gt; HdkM (LConDeclField GhcPs, HasInnerDocs)
-&gt; HdkA (LConDeclField GhcPs, HasInnerDocs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-781"></span><span>    </span><span id="local-6989586621680973746"><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973746"><span class="hs-identifier hs-var">cd_fld_doc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#getPrevNextDoc"><span class="hs-identifier hs-var">getPrevNextDoc</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973748"><span class="hs-identifier hs-var">l_fld</span></a></span><span>
</span><span id="line-782"></span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; ConDeclField GhcPs -&gt; LConDeclField GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973748"><span class="hs-identifier hs-var">l_fld</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConDeclField GhcPs
</span><a href="#local-6989586621680973747"><span class="hs-identifier hs-var">fld</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
cd_fld_doc :: Maybe (GenLocated SrcSpan HsDocString)
cd_fld_doc :: Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Hs.Type.html#cd_fld_doc"><span class="hs-identifier hs-var hs-var">cd_fld_doc</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-783"></span><span>            </span><span class="annot"><span class="annottext">Bool -&gt; HasInnerDocs
</span><a href="GHC.Parser.PostProcess.Haddock.html#HasInnerDocs"><span class="hs-identifier hs-var">HasInnerDocs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString) -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier hs-var">isJust</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973746"><span class="hs-identifier hs-var">cd_fld_doc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-784"></span><span>
</span><span id="line-785"></span><span class="hs-comment">-- 1. Process a H98-syntax data constructor declaration in a context with no</span><span>
</span><span id="line-786"></span><span class="hs-comment">--    access to the trailing documentation comment (by running the provided</span><span>
</span><span id="line-787"></span><span class="hs-comment">--    ConHdkA computation).</span><span>
</span><span id="line-788"></span><span class="hs-comment">--</span><span>
</span><span id="line-789"></span><span class="hs-comment">-- 2. Then grab the trailing comment (if it exists) and attach it where</span><span>
</span><span id="line-790"></span><span class="hs-comment">--    appropriate: either to the data constructor itself or to its last field,</span><span>
</span><span id="line-791"></span><span class="hs-comment">--    depending on HasInnerDocs.</span><span>
</span><span id="line-792"></span><span class="hs-comment">--</span><span>
</span><span id="line-793"></span><span class="hs-comment">-- See Note [Trailing comment on constructor declaration]</span><span>
</span><span id="line-794"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#addConTrailingDoc"><span class="hs-identifier hs-type">addConTrailingDoc</span></a></span><span>
</span><span id="line-795"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcLoc"><span class="hs-identifier hs-type">SrcLoc</span></a></span><span>  </span><span class="hs-comment">-- The end of a data constructor declaration.</span><span>
</span><span id="line-796"></span><span>             </span><span class="hs-comment">-- Any docprev comment past this point is considered trailing.</span><span>
</span><span id="line-797"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ConHdkA"><span class="hs-identifier hs-type">ConHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#LConDecl"><span class="hs-identifier hs-type">LConDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-798"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#LConDecl"><span class="hs-identifier hs-type">LConDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-799"></span><span id="addConTrailingDoc"><span class="annot"><span class="annottext">addConTrailingDoc :: SrcLoc -&gt; ConHdkA (LConDecl GhcPs) -&gt; HdkA (LConDecl GhcPs)
</span><a href="GHC.Parser.PostProcess.Haddock.html#addConTrailingDoc"><span class="hs-identifier hs-var hs-var">addConTrailingDoc</span></a></span></span><span> </span><span id="local-6989586621680973744"><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680973744"><span class="hs-identifier hs-var">l_sep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-800"></span><span>    </span><span class="annot"><span class="annottext">(HdkM (LConDecl GhcPs, HasInnerDocs) -&gt; HdkM (LConDecl GhcPs))
-&gt; HdkA (LConDecl GhcPs, HasInnerDocs) -&gt; HdkA (LConDecl GhcPs)
forall a b. (HdkM a -&gt; HdkM b) -&gt; HdkA a -&gt; HdkA b
</span><a href="GHC.Parser.PostProcess.Haddock.html#hoistHdkA"><span class="hs-identifier hs-var">hoistHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">HdkM (LConDecl GhcPs, HasInnerDocs) -&gt; HdkM (LConDecl GhcPs)
</span><a href="#local-6989586621680973743"><span class="hs-identifier hs-var">add_trailing_doc</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (LConDecl GhcPs, HasInnerDocs) -&gt; HdkA (LConDecl GhcPs))
-&gt; (ConHdkA (LConDecl GhcPs)
    -&gt; HdkA (LConDecl GhcPs, HasInnerDocs))
-&gt; ConHdkA (LConDecl GhcPs)
-&gt; HdkA (LConDecl GhcPs)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ConHdkA (LConDecl GhcPs) -&gt; HdkA (LConDecl GhcPs, HasInnerDocs)
forall w (m :: * -&gt; *) a. WriterT w m a -&gt; m (a, w)
</span><a href="../../transformers/src/Control.Monad.Trans.Writer.Lazy.html#runWriterT"><span class="hs-identifier hs-var hs-var">runWriterT</span></a></span><span>
</span><span id="line-801"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-802"></span><span>    </span><span class="annot"><a href="#local-6989586621680973743"><span class="hs-identifier hs-type">add_trailing_doc</span></a></span><span>
</span><span id="line-803"></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#LConDecl"><span class="hs-identifier hs-type">LConDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasInnerDocs"><span class="hs-identifier hs-type">HasInnerDocs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-804"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#LConDecl"><span class="hs-identifier hs-type">LConDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-805"></span><span>    </span><span id="local-6989586621680973743"><span class="annot"><span class="annottext">add_trailing_doc :: HdkM (LConDecl GhcPs, HasInnerDocs) -&gt; HdkM (LConDecl GhcPs)
</span><a href="#local-6989586621680973743"><span class="hs-identifier hs-var hs-var">add_trailing_doc</span></a></span></span><span> </span><span id="local-6989586621680973742"><span class="annot"><span class="annottext">HdkM (LConDecl GhcPs, HasInnerDocs)
</span><a href="#local-6989586621680973742"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-806"></span><span>      </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973741"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973741"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621680973740"><span class="annot"><span class="annottext">ConDecl GhcPs
</span><a href="#local-6989586621680973740"><span class="hs-identifier hs-var">con_decl</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasInnerDocs"><span class="hs-identifier hs-type">HasInnerDocs</span></a></span><span> </span><span id="local-6989586621680973739"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680973739"><span class="hs-identifier hs-var">has_inner_docs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-807"></span><span>        </span><span class="annot"><span class="annottext">LocRange
-&gt; HdkM (LConDecl GhcPs, HasInnerDocs)
-&gt; HdkM (LConDecl GhcPs, HasInnerDocs)
forall a. LocRange -&gt; HdkM a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#inLocRange"><span class="hs-identifier hs-var">inLocRange</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe BufPos -&gt; LocRange
</span><a href="GHC.Parser.PostProcess.Haddock.html#locRangeTo"><span class="hs-identifier hs-var">locRangeTo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; Maybe BufPos
</span><a href="GHC.Types.SrcLoc.html#getBufPos"><span class="hs-identifier hs-var">getBufPos</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680973744"><span class="hs-identifier hs-var">l_sep</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HdkM (LConDecl GhcPs, HasInnerDocs)
</span><a href="#local-6989586621680973742"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-808"></span><span>          </span><span class="hs-comment">-- inLocRange delimits the context so that the inner computation</span><span>
</span><span id="line-809"></span><span>          </span><span class="hs-comment">-- will not consume the trailing documentation comment.</span><span>
</span><span id="line-810"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ConDecl GhcPs
</span><a href="#local-6989586621680973740"><span class="hs-identifier hs-var">con_decl</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-811"></span><span>        </span><span class="annot"><a href="GHC.Hs.Decls.html#ConDeclH98"><span class="hs-identifier hs-type">ConDeclH98</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-812"></span><span>          </span><span id="local-6989586621680973738"><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973738"><span class="hs-identifier hs-var">trailingDocs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-813"></span><span>            </span><span class="annot"><span class="annottext">LocRange
-&gt; HdkM [GenLocated SrcSpan HsDocString]
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a. LocRange -&gt; HdkM a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#inLocRange"><span class="hs-identifier hs-var">inLocRange</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe BufPos -&gt; LocRange
</span><a href="GHC.Parser.PostProcess.Haddock.html#locRangeFrom"><span class="hs-identifier hs-var">locRangeFrom</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; Maybe BufPos
</span><a href="GHC.Types.SrcLoc.html#getBufPos"><span class="hs-identifier hs-var">getBufPos</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680973744"><span class="hs-identifier hs-var">l_sep</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(HdkM [GenLocated SrcSpan HsDocString]
 -&gt; HdkM [GenLocated SrcSpan HsDocString])
-&gt; HdkM [GenLocated SrcSpan HsDocString]
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-814"></span><span>            </span><span class="annot"><span class="annottext">(PsLocated HdkComment -&gt; Maybe (GenLocated SrcSpan HsDocString))
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a. (PsLocated HdkComment -&gt; Maybe a) -&gt; HdkM [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#takeHdkComments"><span class="hs-identifier hs-var">takeHdkComments</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment -&gt; Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocPrev"><span class="hs-identifier hs-var">mkDocPrev</span></a></span><span>
</span><span id="line-815"></span><span>          </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973738"><span class="hs-identifier hs-var">trailingDocs</span></a></span><span>
</span><span id="line-816"></span><span>          </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">LConDecl GhcPs -&gt; HdkM (LConDecl GhcPs)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; ConDecl GhcPs -&gt; LConDecl GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973741"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">ConDecl GhcPs
</span><a href="#local-6989586621680973740"><span class="hs-identifier hs-var">con_decl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-817"></span><span>          </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-818"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680973739"><span class="hs-identifier hs-var">has_inner_docs</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-819"></span><span>              </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621680973734"><span class="hs-identifier hs-type">mk_doc_ty</span></a></span><span> </span><span class="hs-glyph">::</span><span>       </span><span class="annot"><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-type">HsScaled</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#LHsType"><span class="hs-identifier hs-type">LHsType</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-820"></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-type">HsScaled</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#LHsType"><span class="hs-identifier hs-type">LHsType</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-821"></span><span>                  </span><span id="local-6989586621680973734"><span class="annot"><span class="annottext">mk_doc_ty :: HsScaled GhcPs (LHsType GhcPs)
-&gt; HdkM (HsScaled GhcPs (LHsType GhcPs))
</span><a href="#local-6989586621680973734"><span class="hs-identifier hs-var hs-var">mk_doc_ty</span></a></span></span><span> </span><span id="local-6989586621680973733"><span class="annot"><span class="annottext">x :: HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973733"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-type">HsScaled</span></a></span><span> </span><span class="annot"><span class="annottext">HsArrow GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#HsDocTy"><span class="hs-identifier hs-type">HsDocTy</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-822"></span><span>                    </span><span class="hs-comment">-- Happens in the following case:</span><span>
</span><span id="line-823"></span><span>                    </span><span class="hs-comment">--</span><span>
</span><span id="line-824"></span><span>                    </span><span class="hs-comment">--    data T =</span><span>
</span><span id="line-825"></span><span>                    </span><span class="hs-comment">--      MkT</span><span>
</span><span id="line-826"></span><span>                    </span><span class="hs-comment">--        -- | Comment on SomeField</span><span>
</span><span id="line-827"></span><span>                    </span><span class="hs-comment">--        SomeField</span><span>
</span><span id="line-828"></span><span>                    </span><span class="hs-comment">--        -- ^ Another comment on SomeField? (rejected)</span><span>
</span><span id="line-829"></span><span>                    </span><span class="hs-comment">--</span><span>
</span><span id="line-830"></span><span>                    </span><span class="hs-comment">-- See tests/.../haddockExtraDocs.hs</span><span>
</span><span id="line-831"></span><span>                    </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973733"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
-&gt; HdkM () -&gt; HdkM (HsScaled GhcPs (LHsType GhcPs))
forall (f :: * -&gt; *) a b. Functor f =&gt; a -&gt; f b -&gt; f a
</span><a href="../../base/src/GHC.Base.html#%3C%24"><span class="hs-operator hs-var">&lt;$</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString] -&gt; HdkM ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#reportExtraDocs"><span class="hs-identifier hs-var">reportExtraDocs</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973738"><span class="hs-identifier hs-var">trailingDocs</span></a></span><span>
</span><span id="line-832"></span><span>                  </span><span class="annot"><a href="#local-6989586621680973734"><span class="hs-identifier hs-var">mk_doc_ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-type">HsScaled</span></a></span><span> </span><span id="local-6989586621680973730"><span class="annot"><span class="annottext">HsArrow GhcPs
</span><a href="#local-6989586621680973730"><span class="hs-identifier hs-var">mult</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973729"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973729"><span class="hs-identifier hs-var">l'</span></a></span></span><span> </span><span id="local-6989586621680973728"><span class="annot"><span class="annottext">HsType GhcPs
</span><a href="#local-6989586621680973728"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-833"></span><span>                    </span><span id="local-6989586621680973727"><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973727"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#selectDocString"><span class="hs-identifier hs-var">selectDocString</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973738"><span class="hs-identifier hs-var">trailingDocs</span></a></span><span>
</span><span id="line-834"></span><span>                    </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">HsArrow GhcPs -&gt; LHsType GhcPs -&gt; HsScaled GhcPs (LHsType GhcPs)
forall pass a. HsArrow pass -&gt; a -&gt; HsScaled pass a
</span><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-var">HsScaled</span></a></span><span> </span><span class="annot"><span class="annottext">HsArrow GhcPs
</span><a href="#local-6989586621680973730"><span class="hs-identifier hs-var">mult</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsType GhcPs
-&gt; Maybe (GenLocated SrcSpan HsDocString) -&gt; LHsType GhcPs
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkLHsDocTy"><span class="hs-identifier hs-var">mkLHsDocTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; HsType GhcPs -&gt; LHsType GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973729"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">HsType GhcPs
</span><a href="#local-6989586621680973728"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973727"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-835"></span><span>              </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621680973726"><span class="hs-identifier hs-type">mk_doc_fld</span></a></span><span> </span><span class="hs-glyph">::</span><span>       </span><span class="annot"><a href="GHC.Hs.Type.html#LConDeclField"><span class="hs-identifier hs-type">LConDeclField</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-836"></span><span>                             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#LConDeclField"><span class="hs-identifier hs-type">LConDeclField</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-837"></span><span>                  </span><span id="local-6989586621680973726"><span class="annot"><span class="annottext">mk_doc_fld :: LConDeclField GhcPs -&gt; HdkM (LConDeclField GhcPs)
</span><a href="#local-6989586621680973726"><span class="hs-identifier hs-var hs-var">mk_doc_fld</span></a></span></span><span> </span><span id="local-6989586621680973725"><span class="annot"><span class="annottext">x :: LConDeclField GhcPs
</span><a href="#local-6989586621680973725"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#ConDeclField"><span class="hs-identifier hs-type">ConDeclField</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cd_fld_doc :: forall pass.
ConDeclField pass -&gt; Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Hs.Type.html#cd_fld_doc"><span class="hs-identifier hs-var">cd_fld_doc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-838"></span><span>                    </span><span class="hs-comment">-- Happens in the following case:</span><span>
</span><span id="line-839"></span><span>                    </span><span class="hs-comment">--</span><span>
</span><span id="line-840"></span><span>                    </span><span class="hs-comment">--    data T =</span><span>
</span><span id="line-841"></span><span>                    </span><span class="hs-comment">--      MkT {</span><span>
</span><span id="line-842"></span><span>                    </span><span class="hs-comment">--        -- | Comment on SomeField</span><span>
</span><span id="line-843"></span><span>                    </span><span class="hs-comment">--        someField :: SomeField</span><span>
</span><span id="line-844"></span><span>                    </span><span class="hs-comment">--      } -- ^ Another comment on SomeField? (rejected)</span><span>
</span><span id="line-845"></span><span>                    </span><span class="hs-comment">--</span><span>
</span><span id="line-846"></span><span>                    </span><span class="hs-comment">-- See tests/.../haddockExtraDocs.hs</span><span>
</span><span id="line-847"></span><span>                    </span><span class="annot"><span class="annottext">LConDeclField GhcPs
</span><a href="#local-6989586621680973725"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">LConDeclField GhcPs -&gt; HdkM () -&gt; HdkM (LConDeclField GhcPs)
forall (f :: * -&gt; *) a b. Functor f =&gt; a -&gt; f b -&gt; f a
</span><a href="../../base/src/GHC.Base.html#%3C%24"><span class="hs-operator hs-var">&lt;$</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString] -&gt; HdkM ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#reportExtraDocs"><span class="hs-identifier hs-var">reportExtraDocs</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973738"><span class="hs-identifier hs-var">trailingDocs</span></a></span><span>
</span><span id="line-848"></span><span>                  </span><span class="annot"><a href="#local-6989586621680973726"><span class="hs-identifier hs-var">mk_doc_fld</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973723"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973723"><span class="hs-identifier hs-var">l'</span></a></span></span><span> </span><span id="local-6989586621680973722"><span class="annot"><span class="annottext">ConDeclField GhcPs
</span><a href="#local-6989586621680973722"><span class="hs-identifier hs-var">con_fld</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-849"></span><span>                    </span><span id="local-6989586621680973721"><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973721"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#selectDocString"><span class="hs-identifier hs-var">selectDocString</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973738"><span class="hs-identifier hs-var">trailingDocs</span></a></span><span>
</span><span id="line-850"></span><span>                    </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConDeclField GhcPs -&gt; LConDeclField GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973723"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConDeclField GhcPs
</span><a href="#local-6989586621680973722"><span class="hs-identifier hs-var">con_fld</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cd_fld_doc :: Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Hs.Type.html#cd_fld_doc"><span class="hs-identifier hs-var">cd_fld_doc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973721"><span class="hs-identifier hs-var">doc</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-851"></span><span>              </span><span id="local-6989586621680973720"><span class="annot"><span class="annottext">HsConDeclDetails GhcPs
</span><a href="#local-6989586621680973720"><span class="hs-identifier hs-var">con_args'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ConDecl GhcPs -&gt; HsConDeclDetails GhcPs
forall pass. ConDecl pass -&gt; HsConDeclDetails pass
</span><a href="GHC.Hs.Decls.html#con_args"><span class="hs-identifier hs-var hs-var">con_args</span></a></span><span> </span><span class="annot"><span class="annottext">ConDecl GhcPs
</span><a href="#local-6989586621680973740"><span class="hs-identifier hs-var">con_decl</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-852"></span><span>                </span><span id="local-6989586621680973719"><span class="annot"><span class="annottext">x :: HsConDeclDetails GhcPs
</span><a href="#local-6989586621680973719"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-type">PrefixCon</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HsConDeclDetails GhcPs
</span><a href="#local-6989586621680973719"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">HsConDeclDetails GhcPs -&gt; HdkM () -&gt; HdkM (HsConDeclDetails GhcPs)
forall (f :: * -&gt; *) a b. Functor f =&gt; a -&gt; f b -&gt; f a
</span><a href="../../base/src/GHC.Base.html#%3C%24"><span class="hs-operator hs-var">&lt;$</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString] -&gt; HdkM ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#reportExtraDocs"><span class="hs-identifier hs-var">reportExtraDocs</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973738"><span class="hs-identifier hs-var">trailingDocs</span></a></span><span>
</span><span id="line-853"></span><span>                </span><span id="local-6989586621680973718"><span class="annot"><span class="annottext">x :: HsConDeclDetails GhcPs
</span><a href="#local-6989586621680973718"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HsConDeclDetails GhcPs
</span><a href="#local-6989586621680973718"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">HsConDeclDetails GhcPs -&gt; HdkM () -&gt; HdkM (HsConDeclDetails GhcPs)
forall (f :: * -&gt; *) a b. Functor f =&gt; a -&gt; f b -&gt; f a
</span><a href="../../base/src/GHC.Base.html#%3C%24"><span class="hs-operator hs-var">&lt;$</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString] -&gt; HdkM ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#reportExtraDocs"><span class="hs-identifier hs-var">reportExtraDocs</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973738"><span class="hs-identifier hs-var">trailingDocs</span></a></span><span>
</span><span id="line-854"></span><span>                </span><span class="annot"><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-type">PrefixCon</span></a></span><span> </span><span id="local-6989586621680973717"><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)]
</span><a href="#local-6989586621680973717"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)] -&gt; HsConDeclDetails GhcPs
forall arg rec. [arg] -&gt; HsConDetails arg rec
</span><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-var">PrefixCon</span></a></span><span> </span><span class="annot"><span class="annottext">([HsScaled GhcPs (LHsType GhcPs)] -&gt; HsConDeclDetails GhcPs)
-&gt; HdkM [HsScaled GhcPs (LHsType GhcPs)]
-&gt; HdkM (HsConDeclDetails GhcPs)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(HsScaled GhcPs (LHsType GhcPs)
 -&gt; HdkM (HsScaled GhcPs (LHsType GhcPs)))
-&gt; [HsScaled GhcPs (LHsType GhcPs)]
-&gt; HdkM [HsScaled GhcPs (LHsType GhcPs)]
forall (f :: * -&gt; *) a. Functor f =&gt; (a -&gt; f a) -&gt; [a] -&gt; f [a]
</span><a href="GHC.Utils.Misc.html#mapLastM"><span class="hs-identifier hs-var">mapLastM</span></a></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
-&gt; HdkM (HsScaled GhcPs (LHsType GhcPs))
</span><a href="#local-6989586621680973734"><span class="hs-identifier hs-var">mk_doc_ty</span></a></span><span> </span><span class="annot"><span class="annottext">[HsScaled GhcPs (LHsType GhcPs)]
</span><a href="#local-6989586621680973717"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-855"></span><span>                </span><span class="annot"><a href="GHC.Hs.Type.html#InfixCon"><span class="hs-identifier hs-type">InfixCon</span></a></span><span> </span><span id="local-6989586621680973716"><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973716"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621680973715"><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973715"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
-&gt; HsScaled GhcPs (LHsType GhcPs) -&gt; HsConDeclDetails GhcPs
forall arg rec. arg -&gt; arg -&gt; HsConDetails arg rec
</span><a href="GHC.Hs.Type.html#InfixCon"><span class="hs-identifier hs-var">InfixCon</span></a></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973716"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">(HsScaled GhcPs (LHsType GhcPs) -&gt; HsConDeclDetails GhcPs)
-&gt; HdkM (HsScaled GhcPs (LHsType GhcPs))
-&gt; HdkM (HsConDeclDetails GhcPs)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
-&gt; HdkM (HsScaled GhcPs (LHsType GhcPs))
</span><a href="#local-6989586621680973734"><span class="hs-identifier hs-var">mk_doc_ty</span></a></span><span> </span><span class="annot"><span class="annottext">HsScaled GhcPs (LHsType GhcPs)
</span><a href="#local-6989586621680973715"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-856"></span><span>                </span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973714"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973714"><span class="hs-identifier hs-var">l_rec</span></a></span></span><span> </span><span id="local-6989586621680973713"><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973713"><span class="hs-identifier hs-var">flds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-857"></span><span>                  </span><span id="local-6989586621680973712"><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973712"><span class="hs-identifier hs-var">flds'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LConDeclField GhcPs -&gt; HdkM (LConDeclField GhcPs))
-&gt; [LConDeclField GhcPs] -&gt; HdkM [LConDeclField GhcPs]
forall (f :: * -&gt; *) a. Functor f =&gt; (a -&gt; f a) -&gt; [a] -&gt; f [a]
</span><a href="GHC.Utils.Misc.html#mapLastM"><span class="hs-identifier hs-var">mapLastM</span></a></span><span> </span><span class="annot"><span class="annottext">LConDeclField GhcPs -&gt; HdkM (LConDeclField GhcPs)
</span><a href="#local-6989586621680973726"><span class="hs-identifier hs-var">mk_doc_fld</span></a></span><span> </span><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973713"><span class="hs-identifier hs-var">flds</span></a></span><span>
</span><span id="line-858"></span><span>                  </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan [LConDeclField GhcPs] -&gt; HsConDeclDetails GhcPs
forall arg rec. rec -&gt; HsConDetails arg rec
</span><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-var">RecCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan
-&gt; [LConDeclField GhcPs]
-&gt; GenLocated SrcSpan [LConDeclField GhcPs]
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973714"><span class="hs-identifier hs-var">l_rec</span></a></span><span> </span><span class="annot"><span class="annottext">[LConDeclField GhcPs]
</span><a href="#local-6989586621680973712"><span class="hs-identifier hs-var">flds'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-859"></span><span>              </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConDecl GhcPs -&gt; LConDecl GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973741"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConDecl GhcPs
</span><a href="#local-6989586621680973740"><span class="hs-identifier hs-var">con_decl</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">con_args :: HsConDeclDetails GhcPs
</span><a href="GHC.Hs.Decls.html#con_args"><span class="hs-identifier hs-var">con_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsConDeclDetails GhcPs
</span><a href="#local-6989586621680973720"><span class="hs-identifier hs-var">con_args'</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-860"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-861"></span><span>              </span><span id="local-6989586621680973711"><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973711"><span class="hs-identifier hs-var">con_doc'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#selectDocString"><span class="hs-identifier hs-var">selectDocString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConDecl GhcPs -&gt; Maybe (GenLocated SrcSpan HsDocString)
forall pass. ConDecl pass -&gt; Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Hs.Decls.html#con_doc"><span class="hs-identifier hs-var hs-var">con_doc</span></a></span><span> </span><span class="annot"><span class="annottext">ConDecl GhcPs
</span><a href="#local-6989586621680973740"><span class="hs-identifier hs-var">con_decl</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
-&gt; [GenLocated SrcSpan HsDocString]
-&gt; [GenLocated SrcSpan HsDocString]
forall a. Maybe a -&gt; [a] -&gt; [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#mcons"><span class="hs-operator hs-var">`mcons`</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973738"><span class="hs-identifier hs-var">trailingDocs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-862"></span><span>              </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ConDecl GhcPs -&gt; LConDecl GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973741"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConDecl GhcPs
</span><a href="#local-6989586621680973740"><span class="hs-identifier hs-var">con_decl</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">con_doc :: Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Hs.Decls.html#con_doc"><span class="hs-identifier hs-var">con_doc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973711"><span class="hs-identifier hs-var">con_doc'</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-863"></span><span>        </span><span class="annot"><span class="annottext">ConDecl GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; HdkM (LConDecl GhcPs)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;addConTrailingDoc: non-H98 ConDecl&quot;</span></span><span>
</span><span id="line-864"></span><span>
</span><span id="line-865"></span><span class="hs-comment">{- Note [Trailing comment on constructor declaration]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The trailing comment after a constructor declaration is associated with the
constructor itself when there are no other comments inside the declaration:

   data T = MkT A B        -- ^ Comment on MkT
   data T = MkT { x :: A } -- ^ Comment on MkT

When there are other comments, the trailing comment applies to the last field:

   data T = MkT -- ^ Comment on MkT
            A   -- ^ Comment on A
            B   -- ^ Comment on B

   data T =
     MkT { a :: A   -- ^ Comment on a
         , b :: B   -- ^ Comment on b
         , c :: C } -- ^ Comment on c

This makes the trailing comment context-sensitive. Example:
      data T =
        -- | comment 1
        MkT Int Bool -- ^ comment 2

    Here, &quot;comment 2&quot; applies to the Bool field.
    But if we removed &quot;comment 1&quot;, then &quot;comment 2&quot; would be apply to the data
    constructor rather than its field.

All of this applies to H98-style data declarations only.
GADTSyntax data constructors don't have any special treatment for the trailing comment.

We implement this in two steps:

  1. Process the data constructor declaration in a delimited context where the
     trailing documentation comment is not visible. Delimiting the context is done
     in addConTrailingDoc.

     When processing the declaration, track whether the constructor or any of
     its fields have a documentation comment associated with them.
     This is done using WriterT HasInnerDocs, see ConHdkA.

  2. Depending on whether HasInnerDocs is True or False, attach the
     trailing documentation comment to the data constructor itself
     or to its last field.
-}</span><span>
</span><span id="line-910"></span><span>
</span><span id="line-911"></span><span id="local-6989586621680974514"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974514"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-type">HsScaled</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974514"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-912"></span><span>  </span><span id="local-6989586621680973705"><span class="annot"><span class="annottext">addHaddock :: HsScaled GhcPs a -&gt; HdkA (HsScaled GhcPs a)
</span><a href="#local-6989586621680973705"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-type">HsScaled</span></a></span><span> </span><span id="local-6989586621680973704"><span class="annot"><span class="annottext">HsArrow GhcPs
</span><a href="#local-6989586621680973704"><span class="hs-identifier hs-var">mult</span></a></span></span><span> </span><span id="local-6989586621680973703"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680973703"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsArrow GhcPs -&gt; a -&gt; HsScaled GhcPs a
forall pass a. HsArrow pass -&gt; a -&gt; HsScaled pass a
</span><a href="GHC.Hs.Type.html#HsScaled"><span class="hs-identifier hs-var">HsScaled</span></a></span><span> </span><span class="annot"><span class="annottext">HsArrow GhcPs
</span><a href="#local-6989586621680973704"><span class="hs-identifier hs-var">mult</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; HsScaled GhcPs a) -&gt; HdkA a -&gt; HdkA (HsScaled GhcPs a)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; HdkA a
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680973703"><span class="hs-identifier hs-var">a</span></a></span></span><span>
</span><span id="line-913"></span><span>
</span><span id="line-914"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#LHsSigWcType"><span class="hs-identifier hs-type">LHsSigWcType</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-915"></span><span>  </span><span id="local-6989586621680973699"><span class="annot"><span class="annottext">addHaddock :: LHsSigWcType GhcPs -&gt; HdkA (LHsSigWcType GhcPs)
</span><a href="#local-6989586621680973699"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#HsWC"><span class="hs-identifier hs-type">HsWC</span></a></span><span> </span><span class="annot"><span class="annottext">XHsWC GhcPs (LHsSigType GhcPs)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680973697"><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680973697"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XHsWC GhcPs (LHsSigType GhcPs)
-&gt; LHsSigType GhcPs -&gt; LHsSigWcType GhcPs
forall pass thing.
XHsWC pass thing -&gt; thing -&gt; HsWildCardBndrs pass thing
</span><a href="GHC.Hs.Type.html#HsWC"><span class="hs-identifier hs-var">HsWC</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XHsWC GhcPs (LHsSigType GhcPs)
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsSigType GhcPs -&gt; LHsSigWcType GhcPs)
-&gt; HdkA (LHsSigType GhcPs) -&gt; HdkA (LHsSigWcType GhcPs)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs -&gt; HdkA (LHsSigType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigType GhcPs
</span><a href="#local-6989586621680973697"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-916"></span><span>
</span><span id="line-917"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#LHsSigType"><span class="hs-identifier hs-type">LHsSigType</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-918"></span><span>  </span><span id="local-6989586621680973693"><span class="annot"><span class="annottext">addHaddock :: LHsSigType GhcPs -&gt; HdkA (LHsSigType GhcPs)
</span><a href="#local-6989586621680973693"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#HsIB"><span class="hs-identifier hs-type">HsIB</span></a></span><span> </span><span class="annot"><span class="annottext">XHsIB GhcPs (LHsType GhcPs)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680973692"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973692"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XHsIB GhcPs (LHsType GhcPs) -&gt; LHsType GhcPs -&gt; LHsSigType GhcPs
forall pass thing.
XHsIB pass thing -&gt; thing -&gt; HsImplicitBndrs pass thing
</span><a href="GHC.Hs.Type.html#HsIB"><span class="hs-identifier hs-var">HsIB</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XHsIB GhcPs (LHsType GhcPs)
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsType GhcPs -&gt; LHsSigType GhcPs)
-&gt; HdkA (LHsType GhcPs) -&gt; HdkA (LHsSigType GhcPs)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs -&gt; HdkA (LHsType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973692"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-919"></span><span>
</span><span id="line-920"></span><span class="hs-comment">-- Process a type, adding documentation comments to function arguments</span><span>
</span><span id="line-921"></span><span class="hs-comment">-- and the result. Many formatting styles are supported.</span><span>
</span><span id="line-922"></span><span class="hs-comment">--</span><span>
</span><span id="line-923"></span><span class="hs-comment">--  my_function ::</span><span>
</span><span id="line-924"></span><span class="hs-comment">--      forall a.</span><span>
</span><span id="line-925"></span><span class="hs-comment">--      Eq a =&gt;</span><span>
</span><span id="line-926"></span><span class="hs-comment">--      Maybe a -&gt;  -- ^ Comment on Maybe a  (function argument)</span><span>
</span><span id="line-927"></span><span class="hs-comment">--      Bool -&gt;     -- ^ Comment on Bool     (function argument)</span><span>
</span><span id="line-928"></span><span class="hs-comment">--      String      -- ^ Comment on String   (the result)</span><span>
</span><span id="line-929"></span><span class="hs-comment">--</span><span>
</span><span id="line-930"></span><span class="hs-comment">--  my_function</span><span>
</span><span id="line-931"></span><span class="hs-comment">--      :: forall a. Eq a</span><span>
</span><span id="line-932"></span><span class="hs-comment">--      =&gt; Maybe a     -- ^ Comment on Maybe a  (function argument)</span><span>
</span><span id="line-933"></span><span class="hs-comment">--      -&gt; Bool        -- ^ Comment on Bool     (function argument)</span><span>
</span><span id="line-934"></span><span class="hs-comment">--      -&gt; String      -- ^ Comment on String   (the result)</span><span>
</span><span id="line-935"></span><span class="hs-comment">--</span><span>
</span><span id="line-936"></span><span class="hs-comment">--  my_function ::</span><span>
</span><span id="line-937"></span><span class="hs-comment">--      forall a. Eq a =&gt;</span><span>
</span><span id="line-938"></span><span class="hs-comment">--      -- | Comment on Maybe a (function argument)</span><span>
</span><span id="line-939"></span><span class="hs-comment">--      Maybe a -&gt;</span><span>
</span><span id="line-940"></span><span class="hs-comment">--      -- | Comment on Bool (function argument)</span><span>
</span><span id="line-941"></span><span class="hs-comment">--      Bool -&gt;</span><span>
</span><span id="line-942"></span><span class="hs-comment">--      -- | Comment on String (the result)</span><span>
</span><span id="line-943"></span><span class="hs-comment">--      String</span><span>
</span><span id="line-944"></span><span class="hs-comment">--</span><span>
</span><span id="line-945"></span><span class="hs-comment">-- This is achieved by simply ignoring (not registering the location of) the</span><span>
</span><span id="line-946"></span><span class="hs-comment">-- function arrow (-&gt;).</span><span>
</span><span id="line-947"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HasHaddock"><span class="hs-identifier hs-type">HasHaddock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Type.html#LHsType"><span class="hs-identifier hs-type">LHsType</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-948"></span><span>  </span><span id="local-6989586621680973679"><span class="annot"><span class="annottext">addHaddock :: LHsType GhcPs -&gt; HdkA (LHsType GhcPs)
</span><a href="#local-6989586621680973679"><span class="hs-identifier hs-var hs-var hs-var hs-var">addHaddock</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973678"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973678"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621680973677"><span class="annot"><span class="annottext">HsType GhcPs
</span><a href="#local-6989586621680973677"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-949"></span><span>    </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkA (LHsType GhcPs) -&gt; HdkA (LHsType GhcPs)
forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var">extendHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973678"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkA (LHsType GhcPs) -&gt; HdkA (LHsType GhcPs))
-&gt; HdkA (LHsType GhcPs) -&gt; HdkA (LHsType GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-950"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HsType GhcPs
</span><a href="#local-6989586621680973677"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-951"></span><span>
</span><span id="line-952"></span><span>      </span><span class="hs-comment">-- forall a b c. t</span><span>
</span><span id="line-953"></span><span>      </span><span class="annot"><a href="GHC.Hs.Type.html#HsForAllTy"><span class="hs-identifier hs-type">HsForAllTy</span></a></span><span> </span><span class="annot"><span class="annottext">XForAllTy GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680973675"><span class="annot"><span class="annottext">HsForAllTelescope GhcPs
</span><a href="#local-6989586621680973675"><span class="hs-identifier hs-var">tele</span></a></span></span><span> </span><span id="local-6989586621680973674"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973674"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-954"></span><span>        </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerLocHdkA"><span class="hs-identifier hs-var">registerLocHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsForAllTelescope GhcPs -&gt; SrcSpan
</span><a href="GHC.Parser.PostProcess.Haddock.html#getForAllTeleLoc"><span class="hs-identifier hs-var">getForAllTeleLoc</span></a></span><span> </span><span class="annot"><span class="annottext">HsForAllTelescope GhcPs
</span><a href="#local-6989586621680973675"><span class="hs-identifier hs-var">tele</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-955"></span><span>        </span><span id="local-6989586621680973672"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973672"><span class="hs-identifier hs-var">body'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs -&gt; HdkA (LHsType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973674"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-956"></span><span>        </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HsType GhcPs -&gt; LHsType GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973678"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XForAllTy GhcPs
-&gt; HsForAllTelescope GhcPs -&gt; LHsType GhcPs -&gt; HsType GhcPs
forall pass.
XForAllTy pass
-&gt; HsForAllTelescope pass -&gt; LHsType pass -&gt; HsType pass
</span><a href="GHC.Hs.Type.html#HsForAllTy"><span class="hs-identifier hs-var">HsForAllTy</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XForAllTy GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">HsForAllTelescope GhcPs
</span><a href="#local-6989586621680973675"><span class="hs-identifier hs-var">tele</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973672"><span class="hs-identifier hs-var">body'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-957"></span><span>
</span><span id="line-958"></span><span>      </span><span class="hs-comment">-- (Eq a, Num a) =&gt; t</span><span>
</span><span id="line-959"></span><span>      </span><span class="annot"><a href="GHC.Hs.Type.html#HsQualTy"><span class="hs-identifier hs-type">HsQualTy</span></a></span><span> </span><span class="annot"><span class="annottext">XQualTy GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680973670"><span class="annot"><span class="annottext">LHsContext GhcPs
</span><a href="#local-6989586621680973670"><span class="hs-identifier hs-var">lhs</span></a></span></span><span> </span><span id="local-6989586621680973669"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973669"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-960"></span><span>        </span><span class="annot"><span class="annottext">LHsContext GhcPs -&gt; HdkA ()
forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var">registerHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">LHsContext GhcPs
</span><a href="#local-6989586621680973670"><span class="hs-identifier hs-var">lhs</span></a></span><span>
</span><span id="line-961"></span><span>        </span><span id="local-6989586621680973668"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973668"><span class="hs-identifier hs-var">rhs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs -&gt; HdkA (LHsType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973669"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-962"></span><span>        </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HsType GhcPs -&gt; LHsType GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973678"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XQualTy GhcPs -&gt; LHsContext GhcPs -&gt; LHsType GhcPs -&gt; HsType GhcPs
forall pass.
XQualTy pass -&gt; LHsContext pass -&gt; LHsType pass -&gt; HsType pass
</span><a href="GHC.Hs.Type.html#HsQualTy"><span class="hs-identifier hs-var">HsQualTy</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XQualTy GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">LHsContext GhcPs
</span><a href="#local-6989586621680973670"><span class="hs-identifier hs-var">lhs</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973668"><span class="hs-identifier hs-var">rhs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-963"></span><span>
</span><span id="line-964"></span><span>      </span><span class="hs-comment">-- arg -&gt; res</span><span>
</span><span id="line-965"></span><span>      </span><span class="annot"><a href="GHC.Hs.Type.html#HsFunTy"><span class="hs-identifier hs-type">HsFunTy</span></a></span><span> </span><span id="local-6989586621680973666"><span class="annot"><span class="annottext">XFunTy GhcPs
</span><a href="#local-6989586621680973666"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621680973665"><span class="annot"><span class="annottext">HsArrow GhcPs
</span><a href="#local-6989586621680973665"><span class="hs-identifier hs-var">mult</span></a></span></span><span> </span><span id="local-6989586621680973664"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973664"><span class="hs-identifier hs-var">lhs</span></a></span></span><span> </span><span id="local-6989586621680973663"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973663"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-966"></span><span>        </span><span id="local-6989586621680973662"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973662"><span class="hs-identifier hs-var">lhs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs -&gt; HdkA (LHsType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973664"><span class="hs-identifier hs-var">lhs</span></a></span><span>
</span><span id="line-967"></span><span>        </span><span id="local-6989586621680973661"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973661"><span class="hs-identifier hs-var">rhs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs -&gt; HdkA (LHsType GhcPs)
forall a. HasHaddock a =&gt; a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#addHaddock"><span class="hs-identifier hs-var">addHaddock</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973663"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-968"></span><span>        </span><span class="hs-identifier">pure</span><span> </span><span class="hs-operator">$</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HsType GhcPs -&gt; LHsType GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973678"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XFunTy GhcPs
-&gt; HsArrow GhcPs -&gt; LHsType GhcPs -&gt; LHsType GhcPs -&gt; HsType GhcPs
forall pass.
XFunTy pass
-&gt; HsArrow pass -&gt; LHsType pass -&gt; LHsType pass -&gt; HsType pass
</span><a href="GHC.Hs.Type.html#HsFunTy"><span class="hs-identifier hs-var">HsFunTy</span></a></span><span> </span><span class="annot"><span class="annottext">XFunTy GhcPs
</span><a href="#local-6989586621680973666"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">HsArrow GhcPs
</span><a href="#local-6989586621680973665"><span class="hs-identifier hs-var">mult</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973662"><span class="hs-identifier hs-var">lhs'</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973661"><span class="hs-identifier hs-var">rhs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-969"></span><span>
</span><span id="line-970"></span><span>      </span><span class="hs-comment">-- other types</span><span>
</span><span id="line-971"></span><span>      </span><span class="annot"><span class="annottext">HsType GhcPs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HdkM (LHsType GhcPs) -&gt; HdkA (LHsType GhcPs)
forall a. HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#liftHdkA"><span class="hs-identifier hs-var">liftHdkA</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkM (LHsType GhcPs) -&gt; HdkA (LHsType GhcPs))
-&gt; HdkM (LHsType GhcPs) -&gt; HdkA (LHsType GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-972"></span><span>        </span><span id="local-6989586621680973660"><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973660"><span class="hs-identifier hs-var">mDoc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#getPrevNextDoc"><span class="hs-identifier hs-var">getPrevNextDoc</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973678"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-973"></span><span>        </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsType GhcPs
-&gt; Maybe (GenLocated SrcSpan HsDocString) -&gt; LHsType GhcPs
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkLHsDocTy"><span class="hs-identifier hs-var">mkLHsDocTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; HsType GhcPs -&gt; LHsType GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973678"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">HsType GhcPs
</span><a href="#local-6989586621680973677"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="#local-6989586621680973660"><span class="hs-identifier hs-var">mDoc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-974"></span><span>
</span><span id="line-975"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
*      HdkA: a layer over HdkM that propagates location information    *
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-980"></span><span>
</span><span id="line-981"></span><span class="hs-comment">-- See Note [Adding Haddock comments to the syntax tree].</span><span>
</span><span id="line-982"></span><span class="hs-comment">--</span><span>
</span><span id="line-983"></span><span class="hs-comment">-- 'HdkA' provides a way to propagate location information from surrounding</span><span>
</span><span id="line-984"></span><span class="hs-comment">-- computations:</span><span>
</span><span id="line-985"></span><span class="hs-comment">--</span><span>
</span><span id="line-986"></span><span class="hs-comment">--   left_neighbour &lt;*&gt; HdkA inner_span inner_m &lt;*&gt; right_neighbour</span><span>
</span><span id="line-987"></span><span class="hs-comment">--</span><span>
</span><span id="line-988"></span><span class="hs-comment">-- Here, the following holds:</span><span>
</span><span id="line-989"></span><span class="hs-comment">--</span><span>
</span><span id="line-990"></span><span class="hs-comment">-- * the 'left_neighbour' will only see Haddock comments until 'bufSpanStart' of 'inner_span'</span><span>
</span><span id="line-991"></span><span class="hs-comment">-- * the 'right_neighbour' will only see Haddock comments after 'bufSpanEnd' of 'inner_span'</span><span>
</span><span id="line-992"></span><span class="hs-comment">-- * the 'inner_m' will only see Haddock comments between its 'left_neighbour' and its 'right_neighbour'</span><span>
</span><span id="line-993"></span><span class="hs-comment">--</span><span>
</span><span id="line-994"></span><span class="hs-comment">-- In other words, every computation:</span><span>
</span><span id="line-995"></span><span class="hs-comment">--</span><span>
</span><span id="line-996"></span><span class="hs-comment">--  * delimits the surrounding computations</span><span>
</span><span id="line-997"></span><span class="hs-comment">--  * is delimited by the surrounding computations</span><span>
</span><span id="line-998"></span><span class="hs-comment">--</span><span>
</span><span id="line-999"></span><span class="hs-comment">--  Therefore, a 'HdkA' computation must be always considered in the context in</span><span>
</span><span id="line-1000"></span><span class="hs-comment">--  which it is used.</span><span>
</span><span id="line-1001"></span><span class="hs-keyword">data</span><span> </span><span id="HdkA"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-var">HdkA</span></a></span></span><span> </span><span id="local-6989586621680974430"><span class="annot"><a href="#local-6989586621680974430"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1002"></span><span>  </span><span id="HdkA"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-var">HdkA</span></a></span></span><span>
</span><span id="line-1003"></span><span>    </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#BufSpan"><span class="hs-identifier hs-type">BufSpan</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Just b  &lt;=&gt; BufSpan occupied by the processed AST element.</span><span>
</span><span id="line-1004"></span><span>                     </span><span class="hs-comment">--             The surrounding computations will not look inside.</span><span>
</span><span id="line-1005"></span><span>                     </span><span class="hs-comment">--</span><span>
</span><span id="line-1006"></span><span>                     </span><span class="hs-comment">-- Nothing &lt;=&gt; No BufSpan (e.g. when the HdkA is constructed by 'pure' or 'liftHdkA').</span><span>
</span><span id="line-1007"></span><span>                     </span><span class="hs-comment">--             The surrounding computations are not delimited.</span><span>
</span><span id="line-1008"></span><span>
</span><span id="line-1009"></span><span>    </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974430"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- The stateful computation that looks up Haddock comments and</span><span>
</span><span id="line-1010"></span><span>              </span><span class="hs-comment">-- adds them to the resulting AST node.</span><span>
</span><span id="line-1011"></span><span>
</span><span id="line-1012"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680973654"><span id="local-6989586621680973657"><span class="annot"><span class="annottext">(forall a b. (a -&gt; b) -&gt; HdkA a -&gt; HdkA b)
-&gt; (forall a b. a -&gt; HdkA b -&gt; HdkA a) -&gt; Functor HdkA
forall a b. a -&gt; HdkA b -&gt; HdkA a
forall a b. (a -&gt; b) -&gt; HdkA a -&gt; HdkA b
forall (f :: * -&gt; *).
(forall a b. (a -&gt; b) -&gt; f a -&gt; f b)
-&gt; (forall a b. a -&gt; f b -&gt; f a) -&gt; Functor f
&lt;$ :: forall a b. a -&gt; HdkA b -&gt; HdkA a
$c&lt;$ :: forall a b. a -&gt; HdkA b -&gt; HdkA a
fmap :: forall a b. (a -&gt; b) -&gt; HdkA a -&gt; HdkA b
$cfmap :: forall a b. (a -&gt; b) -&gt; HdkA a -&gt; HdkA b
</span><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Functor</span></a></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-1013"></span><span>
</span><span id="line-1014"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680973642"><span id="local-6989586621680973644"><span id="local-6989586621680973646"><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1015"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span id="local-6989586621680973633"><span class="annot"><span class="annottext">Maybe BufSpan
</span><a href="#local-6989586621680973633"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span id="local-6989586621680973632"><span class="annot"><span class="annottext">HdkM (a -&gt; b)
</span><a href="#local-6989586621680973632"><span class="hs-identifier hs-var">m1</span></a></span></span><span> </span><span id="local-6989586621680973631"><span class="annot"><span class="annottext">&lt;*&gt; :: forall a b. HdkA (a -&gt; b) -&gt; HdkA a -&gt; HdkA b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;*&gt;</span></a></span></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span id="local-6989586621680973630"><span class="annot"><span class="annottext">Maybe BufSpan
</span><a href="#local-6989586621680973630"><span class="hs-identifier hs-var">l2</span></a></span></span><span> </span><span id="local-6989586621680973629"><span class="annot"><span class="annottext">HdkM a
</span><a href="#local-6989586621680973629"><span class="hs-identifier hs-var">m2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1016"></span><span>    </span><span class="annot"><span class="annottext">Maybe BufSpan -&gt; HdkM b -&gt; HdkA b
forall a. Maybe BufSpan -&gt; HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-var">HdkA</span></a></span><span>
</span><span id="line-1017"></span><span>      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe BufSpan
</span><a href="#local-6989586621680973633"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan -&gt; Maybe BufSpan -&gt; Maybe BufSpan
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan
</span><a href="#local-6989586621680973630"><span class="hs-identifier hs-var">l2</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- The combined BufSpan that covers both subcomputations.</span><span>
</span><span id="line-1018"></span><span>                  </span><span class="hs-comment">--</span><span>
</span><span id="line-1019"></span><span>                  </span><span class="hs-comment">-- The Semigroup instance for Maybe quite conveniently does the right thing:</span><span>
</span><span id="line-1020"></span><span>                  </span><span class="hs-comment">--    Nothing &lt;&gt; b       = b</span><span>
</span><span id="line-1021"></span><span>                  </span><span class="hs-comment">--    a       &lt;&gt; Nothing = a</span><span>
</span><span id="line-1022"></span><span>                  </span><span class="hs-comment">--    Just a  &lt;&gt; Just b  = Just (a &lt;&gt; b)</span><span>
</span><span id="line-1023"></span><span>
</span><span id="line-1024"></span><span>      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HdkM (a -&gt; b) -&gt; HdkM (a -&gt; b)
</span><a href="#local-6989586621680973628"><span class="hs-identifier hs-var">delim1</span></a></span><span> </span><span class="annot"><span class="annottext">HdkM (a -&gt; b)
</span><a href="#local-6989586621680973632"><span class="hs-identifier hs-var">m1</span></a></span><span> </span><span class="annot"><span class="annottext">HdkM (a -&gt; b) -&gt; HdkM a -&gt; HdkM b
forall (f :: * -&gt; *) a b. Applicative f =&gt; f (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HdkM a -&gt; HdkM a
</span><a href="#local-6989586621680973627"><span class="hs-identifier hs-var">delim2</span></a></span><span> </span><span class="annot"><span class="annottext">HdkM a
</span><a href="#local-6989586621680973629"><span class="hs-identifier hs-var">m2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Stateful computations are run in left-to-right order,</span><span>
</span><span id="line-1025"></span><span>                                </span><span class="hs-comment">-- without any smart reordering strategy. So users of this</span><span>
</span><span id="line-1026"></span><span>                                </span><span class="hs-comment">-- operation must take care to traverse the AST</span><span>
</span><span id="line-1027"></span><span>                                </span><span class="hs-comment">-- in concrete syntax order.</span><span>
</span><span id="line-1028"></span><span>                                </span><span class="hs-comment">-- See Note [Smart reordering in HdkA (or lack of thereof)]</span><span>
</span><span id="line-1029"></span><span>                                </span><span class="hs-comment">--</span><span>
</span><span id="line-1030"></span><span>                                </span><span class="hs-comment">-- Each computation is delimited (&quot;sandboxed&quot;)</span><span>
</span><span id="line-1031"></span><span>                                </span><span class="hs-comment">-- in a way that it doesn't see any Haddock</span><span>
</span><span id="line-1032"></span><span>                                </span><span class="hs-comment">-- comments past the neighbouring AST node.</span><span>
</span><span id="line-1033"></span><span>                                </span><span class="hs-comment">-- These delim1/delim2 are key to how HdkA operates.</span><span>
</span><span id="line-1034"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-1035"></span><span>      </span><span class="hs-comment">-- Delimit the LHS by the location information from the RHS</span><span>
</span><span id="line-1036"></span><span>      </span><span id="local-6989586621680973628"><span class="annot"><span class="annottext">delim1 :: HdkM (a -&gt; b) -&gt; HdkM (a -&gt; b)
</span><a href="#local-6989586621680973628"><span class="hs-identifier hs-var hs-var">delim1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LocRange -&gt; HdkM (a -&gt; b) -&gt; HdkM (a -&gt; b)
forall a. LocRange -&gt; HdkM a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#inLocRange"><span class="hs-identifier hs-var">inLocRange</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe BufPos -&gt; LocRange
</span><a href="GHC.Parser.PostProcess.Haddock.html#locRangeTo"><span class="hs-identifier hs-var">locRangeTo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-glyph">@</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="annottext">BufSpan -&gt; BufPos
</span><a href="GHC.Types.SrcLoc.html#bufSpanStart"><span class="hs-identifier hs-var hs-var">bufSpanStart</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan
</span><a href="#local-6989586621680973630"><span class="hs-identifier hs-var">l2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1037"></span><span>      </span><span class="hs-comment">-- Delimit the RHS by the location information from the LHS</span><span>
</span><span id="line-1038"></span><span>      </span><span id="local-6989586621680973627"><span class="annot"><span class="annottext">delim2 :: HdkM a -&gt; HdkM a
</span><a href="#local-6989586621680973627"><span class="hs-identifier hs-var hs-var">delim2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LocRange -&gt; HdkM a -&gt; HdkM a
forall a. LocRange -&gt; HdkM a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#inLocRange"><span class="hs-identifier hs-var">inLocRange</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe BufPos -&gt; LocRange
</span><a href="GHC.Parser.PostProcess.Haddock.html#locRangeFrom"><span class="hs-identifier hs-var">locRangeFrom</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-glyph">@</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="annottext">BufSpan -&gt; BufPos
</span><a href="GHC.Types.SrcLoc.html#bufSpanEnd"><span class="hs-identifier hs-var hs-var">bufSpanEnd</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan
</span><a href="#local-6989586621680973633"><span class="hs-identifier hs-var">l1</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1039"></span><span>
</span><span id="line-1040"></span><span>  </span><span id="local-6989586621680973623"><span class="annot"><span class="annottext">pure :: forall a. a -&gt; HdkA a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var hs-var hs-var hs-var">pure</span></a></span></span><span> </span><span id="local-6989586621680973622"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680973622"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1041"></span><span>    </span><span class="hs-comment">-- Return a value without performing any stateful computation, and without</span><span>
</span><span id="line-1042"></span><span>    </span><span class="hs-comment">-- any delimiting effect on the surrounding computations.</span><span>
</span><span id="line-1043"></span><span>    </span><span class="annot"><span class="annottext">HdkM a -&gt; HdkA a
forall a. HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#liftHdkA"><span class="hs-identifier hs-var">liftHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; HdkM a
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680973622"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1044"></span><span>
</span><span id="line-1045"></span><span class="hs-comment">{- Note [Smart reordering in HdkA (or lack of thereof)]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When traversing the AST, the user must take care to traverse it in concrete
syntax order.

For example, when processing HsFunTy, it's important to get it right and write
it like so:

      HsFunTy _ mult lhs rhs -&gt; do
        lhs' &lt;- addHaddock lhs
        rhs' &lt;- addHaddock rhs
        pure $ L l (HsFunTy noExtField mult lhs' rhs')

Rather than like so:

      HsFunTy _ mult lhs rhs -&gt; do
        rhs' &lt;- addHaddock rhs   -- bad! wrong order
        lhs' &lt;- addHaddock lhs   -- bad! wrong order
        pure $ L l (HsFunTy noExtField mult lhs' rhs')

This is somewhat bug-prone, so we could try to fix this with some Applicative
magic. When we define (&lt;*&gt;) for HdkA, why not reorder the computations as
necessary? In pseudo-code:

  a1 &lt;*&gt; a2 | a1 `before` a2 = ... normal processing ...
            | otherwise      = a1 &lt;**&gt; a2

While this trick could work for any two *adjacent* AST elements out of order
(as in HsFunTy example above), it would fail in more elaborate scenarios (e.g.
processing a list of declarations out of order).

If it's not obvious why this trick doesn't work, ponder this: it's a bit like trying to get
a sorted list by defining a 'smart' concatenation operator in the following manner:

  a ?++ b | a &lt;= b    = a ++ b
          | otherwise = b ++ a

At first glance it seems to work:

  ghci&gt; [1] ?++ [2] ?++ [3]
  [1,2,3]

  ghci&gt; [2] ?++ [1] ?++ [3]
  [1,2,3]                     -- wow, sorted!

But it actually doesn't:

  ghci&gt; [3] ?++ [1] ?++ [2]
  [1,3,2]                     -- not sorted...
-}</span><span>
</span><span id="line-1095"></span><span>
</span><span id="line-1096"></span><span class="hs-comment">-- Run a HdkA computation in an unrestricted LocRange. This is only used at the</span><span>
</span><span id="line-1097"></span><span class="hs-comment">-- top level to run the final computation for the entire module.</span><span>
</span><span id="line-1098"></span><span id="local-6989586621680974677"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#runHdkA"><span class="hs-identifier hs-type">runHdkA</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974677"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkSt"><span class="hs-identifier hs-type">HdkSt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680974677"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkSt"><span class="hs-identifier hs-type">HdkSt</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1099"></span><span id="runHdkA"><span class="annot"><span class="annottext">runHdkA :: forall a. HdkA a -&gt; HdkSt -&gt; (a, HdkSt)
</span><a href="GHC.Parser.PostProcess.Haddock.html#runHdkA"><span class="hs-identifier hs-var hs-var">runHdkA</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680973620"><span class="annot"><span class="annottext">HdkM a
</span><a href="#local-6989586621680973620"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HdkM a -&gt; InlineHdkM a
forall a. HdkM a -&gt; InlineHdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#unHdkM"><span class="hs-identifier hs-var">unHdkM</span></a></span><span> </span><span class="annot"><span class="annottext">HdkM a
</span><a href="#local-6989586621680973620"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">LocRange
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span>
</span><span id="line-1100"></span><span>
</span><span id="line-1101"></span><span class="hs-comment">-- Let the neighbours know about an item at this location.</span><span>
</span><span id="line-1102"></span><span class="hs-comment">--</span><span>
</span><span id="line-1103"></span><span class="hs-comment">-- Consider this example:</span><span>
</span><span id="line-1104"></span><span class="hs-comment">--</span><span>
</span><span id="line-1105"></span><span class="hs-comment">--  class -- | peculiarly placed comment</span><span>
</span><span id="line-1106"></span><span class="hs-comment">--    MyClass a where</span><span>
</span><span id="line-1107"></span><span class="hs-comment">--        my_method :: a -&gt; a</span><span>
</span><span id="line-1108"></span><span class="hs-comment">--</span><span>
</span><span id="line-1109"></span><span class="hs-comment">-- How do we know to reject the &quot;peculiarly placed comment&quot; instead of</span><span>
</span><span id="line-1110"></span><span class="hs-comment">-- associating it with my_method? Its indentation level matches.</span><span>
</span><span id="line-1111"></span><span class="hs-comment">--</span><span>
</span><span id="line-1112"></span><span class="hs-comment">-- But clearly, there's &quot;MyClass a where&quot; separating the comment and my_method.</span><span>
</span><span id="line-1113"></span><span class="hs-comment">-- To take it into account, we must register its location using registerLocHdkA</span><span>
</span><span id="line-1114"></span><span class="hs-comment">-- or registerHdkA.</span><span>
</span><span id="line-1115"></span><span class="hs-comment">--</span><span>
</span><span id="line-1116"></span><span class="hs-comment">-- See Note [Register keyword location].</span><span>
</span><span id="line-1117"></span><span class="hs-comment">-- See Note [Adding Haddock comments to the syntax tree].</span><span>
</span><span id="line-1118"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#registerLocHdkA"><span class="hs-identifier hs-type">registerLocHdkA</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1119"></span><span id="registerLocHdkA"><span class="annot"><span class="annottext">registerLocHdkA :: SrcSpan -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerLocHdkA"><span class="hs-identifier hs-var hs-var">registerLocHdkA</span></a></span></span><span> </span><span id="local-6989586621680973618"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973618"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan -&gt; HdkM () -&gt; HdkA ()
forall a. Maybe BufSpan -&gt; HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-var">HdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; Maybe BufSpan
</span><a href="GHC.Types.SrcLoc.html#getBufSpan"><span class="hs-identifier hs-var">getBufSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973618"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">() -&gt; HdkM ()
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1120"></span><span>
</span><span id="line-1121"></span><span class="hs-comment">-- Let the neighbours know about an item at this location.</span><span>
</span><span id="line-1122"></span><span class="hs-comment">-- A small wrapper over registerLocHdkA.</span><span>
</span><span id="line-1123"></span><span class="hs-comment">--</span><span>
</span><span id="line-1124"></span><span class="hs-comment">-- See Note [Adding Haddock comments to the syntax tree].</span><span>
</span><span id="line-1125"></span><span id="local-6989586621680974633"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-type">registerHdkA</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974633"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-1126"></span><span id="registerHdkA"><span class="annot"><span class="annottext">registerHdkA :: forall a. Located a -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerHdkA"><span class="hs-identifier hs-var hs-var">registerHdkA</span></a></span></span><span> </span><span id="local-6989586621680973616"><span class="annot"><span class="annottext">Located a
</span><a href="#local-6989586621680973616"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HdkA ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#registerLocHdkA"><span class="hs-identifier hs-var">registerLocHdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located a -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located a
</span><a href="#local-6989586621680973616"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1127"></span><span>
</span><span id="line-1128"></span><span class="hs-comment">-- Modify the action of a HdkA computation.</span><span>
</span><span id="line-1129"></span><span id="local-6989586621680974618"><span id="local-6989586621680974619"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#hoistHdkA"><span class="hs-identifier hs-type">hoistHdkA</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974619"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974618"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974619"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974618"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-1130"></span><span id="hoistHdkA"><span class="annot"><span class="annottext">hoistHdkA :: forall a b. (HdkM a -&gt; HdkM b) -&gt; HdkA a -&gt; HdkA b
</span><a href="GHC.Parser.PostProcess.Haddock.html#hoistHdkA"><span class="hs-identifier hs-var hs-var">hoistHdkA</span></a></span></span><span> </span><span id="local-6989586621680973615"><span class="annot"><span class="annottext">HdkM a -&gt; HdkM b
</span><a href="#local-6989586621680973615"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span id="local-6989586621680973614"><span class="annot"><span class="annottext">Maybe BufSpan
</span><a href="#local-6989586621680973614"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621680973613"><span class="annot"><span class="annottext">HdkM a
</span><a href="#local-6989586621680973613"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan -&gt; HdkM b -&gt; HdkA b
forall a. Maybe BufSpan -&gt; HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-var">HdkA</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan
</span><a href="#local-6989586621680973614"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HdkM a -&gt; HdkM b
</span><a href="#local-6989586621680973615"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">HdkM a
</span><a href="#local-6989586621680973613"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1131"></span><span>
</span><span id="line-1132"></span><span class="hs-comment">-- Lift a HdkM computation to HdkA.</span><span>
</span><span id="line-1133"></span><span id="local-6989586621680974643"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#liftHdkA"><span class="hs-identifier hs-type">liftHdkA</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974643"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974643"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1134"></span><span id="liftHdkA"><span class="annot"><span class="annottext">liftHdkA :: forall a. HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#liftHdkA"><span class="hs-identifier hs-var hs-var">liftHdkA</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan -&gt; HdkM a -&gt; HdkA a
forall a. Maybe BufSpan -&gt; HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-var">HdkA</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span>
</span><span id="line-1135"></span><span>
</span><span id="line-1136"></span><span class="hs-comment">-- Extend the declared location span of a 'HdkA' computation:</span><span>
</span><span id="line-1137"></span><span class="hs-comment">--</span><span>
</span><span id="line-1138"></span><span class="hs-comment">--    left_neighbour &lt;*&gt; extendHdkA l x &lt;*&gt; right_neighbour</span><span>
</span><span id="line-1139"></span><span class="hs-comment">--</span><span>
</span><span id="line-1140"></span><span class="hs-comment">-- The declared location of 'x' now includes 'l', so that the surrounding</span><span>
</span><span id="line-1141"></span><span class="hs-comment">-- computations 'left_neighbour' and 'right_neighbour' will not look for</span><span>
</span><span id="line-1142"></span><span class="hs-comment">-- Haddock comments inside the 'l' location span.</span><span>
</span><span id="line-1143"></span><span id="local-6989586621680974644"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-type">extendHdkA</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974644"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974644"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1144"></span><span id="extendHdkA"><span class="annot"><span class="annottext">extendHdkA :: forall a. SrcSpan -&gt; HdkA a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#extendHdkA"><span class="hs-identifier hs-var hs-var">extendHdkA</span></a></span></span><span> </span><span id="local-6989586621680973607"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973607"><span class="hs-identifier hs-var">l'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-type">HdkA</span></a></span><span> </span><span id="local-6989586621680973606"><span class="annot"><span class="annottext">Maybe BufSpan
</span><a href="#local-6989586621680973606"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621680973605"><span class="annot"><span class="annottext">HdkM a
</span><a href="#local-6989586621680973605"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan -&gt; HdkM a -&gt; HdkA a
forall a. Maybe BufSpan -&gt; HdkM a -&gt; HdkA a
</span><a href="GHC.Parser.PostProcess.Haddock.html#HdkA"><span class="hs-identifier hs-var">HdkA</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; Maybe BufSpan
</span><a href="GHC.Types.SrcLoc.html#getBufSpan"><span class="hs-identifier hs-var">getBufSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973607"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan -&gt; Maybe BufSpan -&gt; Maybe BufSpan
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan
</span><a href="#local-6989586621680973606"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HdkM a
</span><a href="#local-6989586621680973605"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1145"></span><span>
</span><span id="line-1146"></span><span>
</span><span id="line-1147"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
*              HdkM: a stateful computation to associate               *
*          accumulated documentation comments with AST nodes           *
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1153"></span><span>
</span><span id="line-1154"></span><span class="hs-comment">-- The state of 'HdkM' contains a list of pending Haddock comments. We go</span><span>
</span><span id="line-1155"></span><span class="hs-comment">-- over the AST, looking up these comments using 'takeHdkComments' and removing</span><span>
</span><span id="line-1156"></span><span class="hs-comment">-- them from the state. The remaining, un-removed ones are ignored with a</span><span>
</span><span id="line-1157"></span><span class="hs-comment">-- warning (-Winvalid-haddock). Also, using a state means we never use the same</span><span>
</span><span id="line-1158"></span><span class="hs-comment">-- Haddock twice.</span><span>
</span><span id="line-1159"></span><span class="hs-comment">--</span><span>
</span><span id="line-1160"></span><span class="hs-comment">-- See Note [Adding Haddock comments to the syntax tree].</span><span>
</span><span id="line-1161"></span><span class="hs-keyword">newtype</span><span> </span><span id="HdkM"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-var">HdkM</span></a></span></span><span> </span><span id="local-6989586621680974375"><span class="annot"><a href="#local-6989586621680974375"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="HdkM"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-var">HdkM</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.Reader.html#ReaderT"><span class="hs-identifier hs-type">ReaderT</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-type">LocRange</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.State.Strict.html#State"><span class="hs-identifier hs-type">State</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkSt"><span class="hs-identifier hs-type">HdkSt</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621680974375"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1162"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680973596"><span id="local-6989586621680973602"><span class="annot"><span class="annottext">(forall a b. (a -&gt; b) -&gt; HdkM a -&gt; HdkM b)
-&gt; (forall a b. a -&gt; HdkM b -&gt; HdkM a) -&gt; Functor HdkM
forall a b. a -&gt; HdkM b -&gt; HdkM a
forall a b. (a -&gt; b) -&gt; HdkM a -&gt; HdkM b
forall (f :: * -&gt; *).
(forall a b. (a -&gt; b) -&gt; f a -&gt; f b)
-&gt; (forall a b. a -&gt; f b -&gt; f a) -&gt; Functor f
&lt;$ :: forall a b. a -&gt; HdkM b -&gt; HdkM a
$c&lt;$ :: forall a b. a -&gt; HdkM b -&gt; HdkM a
fmap :: forall a b. (a -&gt; b) -&gt; HdkM a -&gt; HdkM b
$cfmap :: forall a b. (a -&gt; b) -&gt; HdkM a -&gt; HdkM b
</span><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Functor</span></a></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973564"><span id="local-6989586621680973569"><span id="local-6989586621680973574"><span id="local-6989586621680973579"><span id="local-6989586621680973585"><span class="annot"><span class="annottext">Functor HdkM
Functor HdkM
-&gt; (forall a. a -&gt; HdkM a)
-&gt; (forall a b. HdkM (a -&gt; b) -&gt; HdkM a -&gt; HdkM b)
-&gt; (forall a b c. (a -&gt; b -&gt; c) -&gt; HdkM a -&gt; HdkM b -&gt; HdkM c)
-&gt; (forall a b. HdkM a -&gt; HdkM b -&gt; HdkM b)
-&gt; (forall a b. HdkM a -&gt; HdkM b -&gt; HdkM a)
-&gt; Applicative HdkM
forall a. a -&gt; HdkM a
forall a b. HdkM a -&gt; HdkM b -&gt; HdkM a
forall a b. HdkM a -&gt; HdkM b -&gt; HdkM b
forall a b. HdkM (a -&gt; b) -&gt; HdkM a -&gt; HdkM b
forall a b c. (a -&gt; b -&gt; c) -&gt; HdkM a -&gt; HdkM b -&gt; HdkM c
forall (f :: * -&gt; *).
Functor f
-&gt; (forall a. a -&gt; f a)
-&gt; (forall a b. f (a -&gt; b) -&gt; f a -&gt; f b)
-&gt; (forall a b c. (a -&gt; b -&gt; c) -&gt; f a -&gt; f b -&gt; f c)
-&gt; (forall a b. f a -&gt; f b -&gt; f b)
-&gt; (forall a b. f a -&gt; f b -&gt; f a)
-&gt; Applicative f
&lt;* :: forall a b. HdkM a -&gt; HdkM b -&gt; HdkM a
$c&lt;* :: forall a b. HdkM a -&gt; HdkM b -&gt; HdkM a
*&gt; :: forall a b. HdkM a -&gt; HdkM b -&gt; HdkM b
$c*&gt; :: forall a b. HdkM a -&gt; HdkM b -&gt; HdkM b
liftA2 :: forall a b c. (a -&gt; b -&gt; c) -&gt; HdkM a -&gt; HdkM b -&gt; HdkM c
$cliftA2 :: forall a b c. (a -&gt; b -&gt; c) -&gt; HdkM a -&gt; HdkM b -&gt; HdkM c
&lt;*&gt; :: forall a b. HdkM (a -&gt; b) -&gt; HdkM a -&gt; HdkM b
$c&lt;*&gt; :: forall a b. HdkM (a -&gt; b) -&gt; HdkM a -&gt; HdkM b
pure :: forall a. a -&gt; HdkM a
$cpure :: forall a. a -&gt; HdkM a
</span><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Applicative</span></a></span></span></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973540"><span id="local-6989586621680973545"><span id="local-6989586621680973551"><span class="annot"><span class="annottext">Applicative HdkM
Applicative HdkM
-&gt; (forall a b. HdkM a -&gt; (a -&gt; HdkM b) -&gt; HdkM b)
-&gt; (forall a b. HdkM a -&gt; HdkM b -&gt; HdkM b)
-&gt; (forall a. a -&gt; HdkM a)
-&gt; Monad HdkM
forall a. a -&gt; HdkM a
forall a b. HdkM a -&gt; HdkM b -&gt; HdkM b
forall a b. HdkM a -&gt; (a -&gt; HdkM b) -&gt; HdkM b
forall (m :: * -&gt; *).
Applicative m
-&gt; (forall a b. m a -&gt; (a -&gt; m b) -&gt; m b)
-&gt; (forall a b. m a -&gt; m b -&gt; m b)
-&gt; (forall a. a -&gt; m a)
-&gt; Monad m
return :: forall a. a -&gt; HdkM a
$creturn :: forall a. a -&gt; HdkM a
&gt;&gt; :: forall a b. HdkM a -&gt; HdkM b -&gt; HdkM b
$c&gt;&gt; :: forall a b. HdkM a -&gt; HdkM b -&gt; HdkM b
&gt;&gt;= :: forall a b. HdkM a -&gt; (a -&gt; HdkM b) -&gt; HdkM b
$c&gt;&gt;= :: forall a b. HdkM a -&gt; (a -&gt; HdkM b) -&gt; HdkM b
</span><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Monad</span></a></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-1163"></span><span>
</span><span id="line-1164"></span><span class="hs-comment">-- | The state of HdkM.</span><span>
</span><span id="line-1165"></span><span class="hs-keyword">data</span><span> </span><span id="HdkSt"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkSt"><span class="hs-identifier hs-var">HdkSt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1166"></span><span>  </span><span id="HdkSt"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkSt"><span class="hs-identifier hs-var">HdkSt</span></a></span></span><span>
</span><span id="line-1167"></span><span>    </span><span class="hs-special">{</span><span> </span><span id="hdk_st_pending"><span class="annot"><span class="annottext">HdkSt -&gt; [PsLocated HdkComment]
</span><a href="GHC.Parser.PostProcess.Haddock.html#hdk_st_pending"><span class="hs-identifier hs-var hs-var">hdk_st_pending</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1168"></span><span>        </span><span class="hs-comment">-- a list of pending (unassociated with an AST node)</span><span>
</span><span id="line-1169"></span><span>        </span><span class="hs-comment">-- Haddock comments, sorted by location: in ascending order of the starting 'BufPos'</span><span>
</span><span id="line-1170"></span><span>    </span><span class="hs-special">,</span><span> </span><span id="hdk_st_warnings"><span class="annot"><span class="annottext">HdkSt -&gt; [HdkWarn]
</span><a href="GHC.Parser.PostProcess.Haddock.html#hdk_st_warnings"><span class="hs-identifier hs-var hs-var">hdk_st_warnings</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkWarn"><span class="hs-identifier hs-type">HdkWarn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1171"></span><span>        </span><span class="hs-comment">-- accumulated warnings (order doesn't matter)</span><span>
</span><span id="line-1172"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-1173"></span><span>
</span><span id="line-1174"></span><span class="hs-comment">-- | Warnings accumulated in HdkM.</span><span>
</span><span id="line-1175"></span><span class="hs-keyword">data</span><span> </span><span id="HdkWarn"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkWarn"><span class="hs-identifier hs-var">HdkWarn</span></a></span></span><span>
</span><span id="line-1176"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="HdkWarnInvalidComment"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkWarnInvalidComment"><span class="hs-identifier hs-var">HdkWarnInvalidComment</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1177"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="HdkWarnExtraComment"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkWarnExtraComment"><span class="hs-identifier hs-var">HdkWarnExtraComment</span></a></span></span><span> </span><span class="annot"><a href="GHC.Hs.Doc.html#LHsDocString"><span class="hs-identifier hs-type">LHsDocString</span></a></span><span>
</span><span id="line-1178"></span><span>
</span><span id="line-1179"></span><span class="hs-comment">-- 'HdkM' without newtype wrapping/unwrapping.</span><span>
</span><span id="line-1180"></span><span class="hs-keyword">type</span><span> </span><span id="InlineHdkM"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#InlineHdkM"><span class="hs-identifier hs-var">InlineHdkM</span></a></span></span><span> </span><span id="local-6989586621680973534"><span class="annot"><a href="#local-6989586621680973534"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-type">LocRange</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkSt"><span class="hs-identifier hs-type">HdkSt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680973534"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkSt"><span class="hs-identifier hs-type">HdkSt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1181"></span><span>
</span><span id="line-1182"></span><span id="local-6989586621680974381"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mkHdkM"><span class="hs-identifier hs-type">mkHdkM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#InlineHdkM"><span class="hs-identifier hs-type">InlineHdkM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974381"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974381"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1183"></span><span id="local-6989586621680974426"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#unHdkM"><span class="hs-identifier hs-type">unHdkM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974426"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#InlineHdkM"><span class="hs-identifier hs-type">InlineHdkM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974426"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1184"></span><span id="mkHdkM"><span class="annot"><span class="annottext">mkHdkM :: forall a. InlineHdkM a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkHdkM"><span class="hs-identifier hs-var hs-var">mkHdkM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InlineHdkM a -&gt; HdkM a
</span><span class="hs-identifier hs-var">coerce</span></span><span>
</span><span id="line-1185"></span><span id="unHdkM"><span class="annot"><span class="annottext">unHdkM :: forall a. HdkM a -&gt; InlineHdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#unHdkM"><span class="hs-identifier hs-var hs-var">unHdkM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HdkM a -&gt; InlineHdkM a
</span><span class="hs-identifier hs-var">coerce</span></span><span>
</span><span id="line-1186"></span><span>
</span><span id="line-1187"></span><span class="hs-comment">-- Restrict the range in which a HdkM computation will look up comments:</span><span>
</span><span id="line-1188"></span><span class="hs-comment">--</span><span>
</span><span id="line-1189"></span><span class="hs-comment">--   inLocRange r1 $</span><span>
</span><span id="line-1190"></span><span class="hs-comment">--   inLocRange r2 $</span><span>
</span><span id="line-1191"></span><span class="hs-comment">--     takeHdkComments ...  -- Only takes comments in the (r1 &lt;&gt; r2) location range.</span><span>
</span><span id="line-1192"></span><span class="hs-comment">--</span><span>
</span><span id="line-1193"></span><span class="hs-comment">-- Note that it does not blindly override the range but tightens it using (&lt;&gt;).</span><span>
</span><span id="line-1194"></span><span class="hs-comment">-- At many use sites, you will see something along the lines of:</span><span>
</span><span id="line-1195"></span><span class="hs-comment">--</span><span>
</span><span id="line-1196"></span><span class="hs-comment">--   inLocRange (locRangeTo end_pos) $ ...</span><span>
</span><span id="line-1197"></span><span class="hs-comment">--</span><span>
</span><span id="line-1198"></span><span class="hs-comment">-- And 'locRangeTo' defines a location range from the start of the file to</span><span>
</span><span id="line-1199"></span><span class="hs-comment">-- 'end_pos'. This does not mean that we now search for every comment from the</span><span>
</span><span id="line-1200"></span><span class="hs-comment">-- start of the file, as this restriction will be combined with other</span><span>
</span><span id="line-1201"></span><span class="hs-comment">-- restrictions. Somewhere up the callstack we might have:</span><span>
</span><span id="line-1202"></span><span class="hs-comment">--</span><span>
</span><span id="line-1203"></span><span class="hs-comment">--   inLocRange (locRangeFrom start_pos) $ ...</span><span>
</span><span id="line-1204"></span><span class="hs-comment">--</span><span>
</span><span id="line-1205"></span><span class="hs-comment">-- The net result is that the location range is delimited by 'start_pos' on</span><span>
</span><span id="line-1206"></span><span class="hs-comment">-- one side and by 'end_pos' on the other side.</span><span>
</span><span id="line-1207"></span><span class="hs-comment">--</span><span>
</span><span id="line-1208"></span><span class="hs-comment">-- In 'HdkA', every (&lt;*&gt;) may restrict the location range of its</span><span>
</span><span id="line-1209"></span><span class="hs-comment">-- subcomputations.</span><span>
</span><span id="line-1210"></span><span id="local-6989586621680974642"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#inLocRange"><span class="hs-identifier hs-type">inLocRange</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-type">LocRange</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974642"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974642"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1211"></span><span id="inLocRange"><span class="annot"><span class="annottext">inLocRange :: forall a. LocRange -&gt; HdkM a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#inLocRange"><span class="hs-identifier hs-var hs-var">inLocRange</span></a></span></span><span> </span><span id="local-6989586621680973529"><span class="annot"><span class="annottext">LocRange
</span><a href="#local-6989586621680973529"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span id="local-6989586621680973528"><span class="annot"><span class="annottext">ReaderT LocRange (State HdkSt) a
</span><a href="#local-6989586621680973528"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ReaderT LocRange (State HdkSt) a -&gt; HdkM a
forall a. ReaderT LocRange (State HdkSt) a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-var">HdkM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LocRange -&gt; LocRange)
-&gt; ReaderT LocRange (State HdkSt) a
-&gt; ReaderT LocRange (State HdkSt) a
forall r (m :: * -&gt; *) a.
(r -&gt; r) -&gt; ReaderT r m a -&gt; ReaderT r m a
</span><a href="../../transformers/src/Control.Monad.Trans.Reader.html#local"><span class="hs-identifier hs-var">local</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocRange -&gt; LocRange -&gt; LocRange
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-identifier hs-var">mappend</span></a></span><span> </span><span class="annot"><span class="annottext">LocRange
</span><a href="#local-6989586621680973529"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ReaderT LocRange (State HdkSt) a
</span><a href="#local-6989586621680973528"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1212"></span><span>
</span><span id="line-1213"></span><span class="hs-comment">-- Take the Haddock comments that satisfy the matching function,</span><span>
</span><span id="line-1214"></span><span class="hs-comment">-- leaving the rest pending.</span><span>
</span><span id="line-1215"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#takeHdkComments"><span class="hs-identifier hs-type">takeHdkComments</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680974639"><span class="annot"><a href="#local-6989586621680974639"><span class="hs-identifier hs-type">a</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974639"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680974639"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1216"></span><span id="takeHdkComments"><span class="annot"><span class="annottext">takeHdkComments :: forall a. (PsLocated HdkComment -&gt; Maybe a) -&gt; HdkM [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#takeHdkComments"><span class="hs-identifier hs-var hs-var">takeHdkComments</span></a></span></span><span> </span><span id="local-6989586621680973523"><span class="annot"><span class="annottext">PsLocated HdkComment -&gt; Maybe a
</span><a href="#local-6989586621680973523"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1217"></span><span>  </span><span class="annot"><span class="annottext">InlineHdkM [a] -&gt; HdkM [a]
forall a. InlineHdkM a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkHdkM"><span class="hs-identifier hs-var">mkHdkM</span></a></span><span> </span><span class="annot"><span class="annottext">(InlineHdkM [a] -&gt; HdkM [a]) -&gt; InlineHdkM [a] -&gt; HdkM [a]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1218"></span><span>    </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-type">LocRange</span></a></span><span> </span><span id="local-6989586621680973521"><span class="annot"><span class="annottext">LowerLocBound
</span><a href="#local-6989586621680973521"><span class="hs-identifier hs-var">hdk_from</span></a></span></span><span> </span><span id="local-6989586621680973520"><span class="annot"><span class="annottext">UpperLocBound
</span><a href="#local-6989586621680973520"><span class="hs-identifier hs-var">hdk_to</span></a></span></span><span> </span><span id="local-6989586621680973519"><span class="annot"><span class="annottext">ColumnBound
</span><a href="#local-6989586621680973519"><span class="hs-identifier hs-var">hdk_col</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1219"></span><span>    </span><span class="hs-glyph">\</span><span id="local-6989586621680973518"><span class="annot"><span class="annottext">HdkSt
</span><a href="#local-6989586621680973518"><span class="hs-identifier hs-var">hdk_st</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1220"></span><span>      </span><span class="hs-keyword">let</span><span>
</span><span id="line-1221"></span><span>        </span><span id="local-6989586621680973517"><span class="annot"><span class="annottext">comments :: [PsLocated HdkComment]
</span><a href="#local-6989586621680973517"><span class="hs-identifier hs-var hs-var">comments</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HdkSt -&gt; [PsLocated HdkComment]
</span><a href="GHC.Parser.PostProcess.Haddock.html#hdk_st_pending"><span class="hs-identifier hs-var hs-var">hdk_st_pending</span></a></span><span> </span><span class="annot"><span class="annottext">HdkSt
</span><a href="#local-6989586621680973518"><span class="hs-identifier hs-var">hdk_st</span></a></span><span>
</span><span id="line-1222"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680973516"><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973516"><span class="hs-identifier hs-var">comments_before_range</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973515"><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973515"><span class="hs-identifier hs-var">comments'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(PsLocated HdkComment -&gt; Bool)
-&gt; [PsLocated HdkComment]
-&gt; ([PsLocated HdkComment], [PsLocated HdkComment])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LowerLocBound -&gt; PsLocated HdkComment -&gt; Bool
forall {e}. LowerLocBound -&gt; GenLocated PsSpan e -&gt; Bool
</span><a href="#local-6989586621680973513"><span class="hs-identifier hs-var">is_after</span></a></span><span> </span><span class="annot"><span class="annottext">LowerLocBound
</span><a href="#local-6989586621680973521"><span class="hs-identifier hs-var">hdk_from</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973517"><span class="hs-identifier hs-var">comments</span></a></span><span>
</span><span id="line-1223"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680973512"><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973512"><span class="hs-identifier hs-var">comments_in_range</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973511"><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973511"><span class="hs-identifier hs-var">comments_after_range</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(PsLocated HdkComment -&gt; Bool)
-&gt; [PsLocated HdkComment]
-&gt; ([PsLocated HdkComment], [PsLocated HdkComment])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#span"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UpperLocBound -&gt; PsLocated HdkComment -&gt; Bool
forall {e}. UpperLocBound -&gt; GenLocated PsSpan e -&gt; Bool
</span><a href="#local-6989586621680973509"><span class="hs-identifier hs-var">is_before</span></a></span><span> </span><span class="annot"><span class="annottext">UpperLocBound
</span><a href="#local-6989586621680973520"><span class="hs-identifier hs-var">hdk_to</span></a></span><span> </span><span class="annot"><span class="annottext">(PsLocated HdkComment -&gt; Bool)
-&gt; (PsLocated HdkComment -&gt; Bool) -&gt; PsLocated HdkComment -&gt; Bool
forall (f :: * -&gt; *). Applicative f =&gt; f Bool -&gt; f Bool -&gt; f Bool
</span><a href="GHC.Utils.Misc.html#%3C%26%26%3E"><span class="hs-operator hs-var">&lt;&amp;&amp;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ColumnBound -&gt; PsLocated HdkComment -&gt; Bool
forall {e}. ColumnBound -&gt; GenLocated PsSpan e -&gt; Bool
</span><a href="#local-6989586621680973508"><span class="hs-identifier hs-var">is_indented</span></a></span><span> </span><span class="annot"><span class="annottext">ColumnBound
</span><a href="#local-6989586621680973519"><span class="hs-identifier hs-var">hdk_col</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973515"><span class="hs-identifier hs-var">comments'</span></a></span><span>
</span><span id="line-1224"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680973507"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680973507"><span class="hs-identifier hs-var">items</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973506"><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973506"><span class="hs-identifier hs-var">other_comments</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(PsLocated HdkComment
 -&gt; ([a], [PsLocated HdkComment]) -&gt; ([a], [PsLocated HdkComment]))
-&gt; ([a], [PsLocated HdkComment])
-&gt; [PsLocated HdkComment]
-&gt; ([a], [PsLocated HdkComment])
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment
-&gt; ([a], [PsLocated HdkComment]) -&gt; ([a], [PsLocated HdkComment])
</span><a href="#local-6989586621680973504"><span class="hs-identifier hs-var">add_comment</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973512"><span class="hs-identifier hs-var">comments_in_range</span></a></span><span>
</span><span id="line-1225"></span><span>        </span><span id="local-6989586621680973503"><span class="annot"><span class="annottext">remaining_comments :: [PsLocated HdkComment]
</span><a href="#local-6989586621680973503"><span class="hs-identifier hs-var hs-var">remaining_comments</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973516"><span class="hs-identifier hs-var">comments_before_range</span></a></span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
-&gt; [PsLocated HdkComment] -&gt; [PsLocated HdkComment]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973506"><span class="hs-identifier hs-var">other_comments</span></a></span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
-&gt; [PsLocated HdkComment] -&gt; [PsLocated HdkComment]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973511"><span class="hs-identifier hs-var">comments_after_range</span></a></span><span>
</span><span id="line-1226"></span><span>        </span><span id="local-6989586621680973502"><span class="annot"><span class="annottext">hdk_st' :: HdkSt
</span><a href="#local-6989586621680973502"><span class="hs-identifier hs-var hs-var">hdk_st'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HdkSt
</span><a href="#local-6989586621680973518"><span class="hs-identifier hs-var">hdk_st</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hdk_st_pending :: [PsLocated HdkComment]
</span><a href="GHC.Parser.PostProcess.Haddock.html#hdk_st_pending"><span class="hs-identifier hs-var">hdk_st_pending</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973503"><span class="hs-identifier hs-var">remaining_comments</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1227"></span><span>      </span><span class="hs-keyword">in</span><span>
</span><span id="line-1228"></span><span>        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680973507"><span class="hs-identifier hs-var">items</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HdkSt
</span><a href="#local-6989586621680973502"><span class="hs-identifier hs-var">hdk_st'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1229"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1230"></span><span>    </span><span id="local-6989586621680973513"><span class="annot"><span class="annottext">is_after :: LowerLocBound -&gt; GenLocated PsSpan e -&gt; Bool
</span><a href="#local-6989586621680973513"><span class="hs-identifier hs-var hs-var">is_after</span></a></span></span><span>    </span><span class="annot"><span class="annottext">LowerLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#StartOfFile"><span class="hs-identifier hs-var">StartOfFile</span></a></span><span>    </span><span class="annot"><span class="annottext">GenLocated PsSpan e
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1231"></span><span>    </span><span class="annot"><a href="#local-6989586621680973513"><span class="hs-identifier hs-var">is_after</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#StartLoc"><span class="hs-identifier hs-type">StartLoc</span></a></span><span> </span><span id="local-6989586621680973497"><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973497"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973496"><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973496"><span class="hs-identifier hs-var">l_comment</span></a></span></span><span> </span><span class="annot"><span class="annottext">e
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BufSpan -&gt; BufPos
</span><a href="GHC.Types.SrcLoc.html#bufSpanStart"><span class="hs-identifier hs-var hs-var">bufSpanStart</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PsSpan -&gt; BufSpan
</span><a href="GHC.Types.SrcLoc.html#psBufSpan"><span class="hs-identifier hs-var hs-var">psBufSpan</span></a></span><span> </span><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973496"><span class="hs-identifier hs-var">l_comment</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BufPos -&gt; BufPos -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973497"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1232"></span><span>    </span><span id="local-6989586621680973509"><span class="annot"><span class="annottext">is_before :: UpperLocBound -&gt; GenLocated PsSpan e -&gt; Bool
</span><a href="#local-6989586621680973509"><span class="hs-identifier hs-var hs-var">is_before</span></a></span></span><span>   </span><span class="annot"><span class="annottext">UpperLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#EndOfFile"><span class="hs-identifier hs-var">EndOfFile</span></a></span><span>      </span><span class="annot"><span class="annottext">GenLocated PsSpan e
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1233"></span><span>    </span><span class="annot"><a href="#local-6989586621680973509"><span class="hs-identifier hs-var">is_before</span></a></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#EndLoc"><span class="hs-identifier hs-type">EndLoc</span></a></span><span> </span><span id="local-6989586621680973491"><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973491"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973490"><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973490"><span class="hs-identifier hs-var">l_comment</span></a></span></span><span> </span><span class="annot"><span class="annottext">e
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BufSpan -&gt; BufPos
</span><a href="GHC.Types.SrcLoc.html#bufSpanStart"><span class="hs-identifier hs-var hs-var">bufSpanStart</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PsSpan -&gt; BufSpan
</span><a href="GHC.Types.SrcLoc.html#psBufSpan"><span class="hs-identifier hs-var hs-var">psBufSpan</span></a></span><span> </span><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973490"><span class="hs-identifier hs-var">l_comment</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BufPos -&gt; BufPos -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973491"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1234"></span><span>    </span><span id="local-6989586621680973508"><span class="annot"><span class="annottext">is_indented :: ColumnBound -&gt; GenLocated PsSpan e -&gt; Bool
</span><a href="#local-6989586621680973508"><span class="hs-identifier hs-var hs-var">is_indented</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ColumnFrom"><span class="hs-identifier hs-type">ColumnFrom</span></a></span><span> </span><span id="local-6989586621680973486"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973486"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973485"><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973485"><span class="hs-identifier hs-var">l_comment</span></a></span></span><span> </span><span class="annot"><span class="annottext">e
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealSrcSpan -&gt; Int
</span><a href="GHC.Types.SrcLoc.html#srcSpanStartCol"><span class="hs-identifier hs-var">srcSpanStartCol</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PsSpan -&gt; RealSrcSpan
</span><a href="GHC.Types.SrcLoc.html#psRealSpan"><span class="hs-identifier hs-var hs-var">psRealSpan</span></a></span><span> </span><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973485"><span class="hs-identifier hs-var">l_comment</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973486"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1235"></span><span>
</span><span id="line-1236"></span><span>    </span><span class="annot"><a href="#local-6989586621680973504"><span class="hs-identifier hs-type">add_comment</span></a></span><span>
</span><span id="line-1237"></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span>
</span><span id="line-1238"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680974639"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1239"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680974639"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1240"></span><span>    </span><span id="local-6989586621680973504"><span class="annot"><span class="annottext">add_comment :: PsLocated HdkComment
-&gt; ([a], [PsLocated HdkComment]) -&gt; ([a], [PsLocated HdkComment])
</span><a href="#local-6989586621680973504"><span class="hs-identifier hs-var hs-var">add_comment</span></a></span></span><span> </span><span id="local-6989586621680973482"><span class="annot"><span class="annottext">PsLocated HdkComment
</span><a href="#local-6989586621680973482"><span class="hs-identifier hs-var">hdk_comment</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680973481"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680973481"><span class="hs-identifier hs-var">items</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973480"><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973480"><span class="hs-identifier hs-var">other_hdk_comments</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1241"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment -&gt; Maybe a
</span><a href="#local-6989586621680973523"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment
</span><a href="#local-6989586621680973482"><span class="hs-identifier hs-var">hdk_comment</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1242"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680973479"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680973479"><span class="hs-identifier hs-var">item</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680973479"><span class="hs-identifier hs-var">item</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680973481"><span class="hs-identifier hs-var">items</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973480"><span class="hs-identifier hs-var">other_hdk_comments</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1243"></span><span>        </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680973481"><span class="hs-identifier hs-var">items</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment
</span><a href="#local-6989586621680973482"><span class="hs-identifier hs-var">hdk_comment</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment
-&gt; [PsLocated HdkComment] -&gt; [PsLocated HdkComment]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[PsLocated HdkComment]
</span><a href="#local-6989586621680973480"><span class="hs-identifier hs-var">other_hdk_comments</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1244"></span><span>
</span><span id="line-1245"></span><span class="hs-comment">-- Get the docnext or docprev comment for an AST node at the given source span.</span><span>
</span><span id="line-1246"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#getPrevNextDoc"><span class="hs-identifier hs-type">getPrevNextDoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Doc.html#LHsDocString"><span class="hs-identifier hs-type">LHsDocString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1247"></span><span id="getPrevNextDoc"><span class="annot"><span class="annottext">getPrevNextDoc :: SrcSpan -&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#getPrevNextDoc"><span class="hs-identifier hs-var hs-var">getPrevNextDoc</span></a></span></span><span> </span><span id="local-6989586621680973478"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973478"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1248"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680973477"><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680973477"><span class="hs-identifier hs-var">l_start</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973476"><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680973476"><span class="hs-identifier hs-var">l_end</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcLoc
</span><a href="GHC.Types.SrcLoc.html#srcSpanStart"><span class="hs-identifier hs-var">srcSpanStart</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973478"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcLoc
</span><a href="GHC.Types.SrcLoc.html#srcSpanEnd"><span class="hs-identifier hs-var">srcSpanEnd</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973478"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1249"></span><span>      </span><span id="local-6989586621680973475"><span class="annot"><span class="annottext">before_t :: LocRange
</span><a href="#local-6989586621680973475"><span class="hs-identifier hs-var hs-var">before_t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe BufPos -&gt; LocRange
</span><a href="GHC.Parser.PostProcess.Haddock.html#locRangeTo"><span class="hs-identifier hs-var">locRangeTo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; Maybe BufPos
</span><a href="GHC.Types.SrcLoc.html#getBufPos"><span class="hs-identifier hs-var">getBufPos</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680973477"><span class="hs-identifier hs-var">l_start</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1250"></span><span>      </span><span id="local-6989586621680973474"><span class="annot"><span class="annottext">after_t :: LocRange
</span><a href="#local-6989586621680973474"><span class="hs-identifier hs-var hs-var">after_t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe BufPos -&gt; LocRange
</span><a href="GHC.Parser.PostProcess.Haddock.html#locRangeFrom"><span class="hs-identifier hs-var">locRangeFrom</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcLoc -&gt; Maybe BufPos
</span><a href="GHC.Types.SrcLoc.html#getBufPos"><span class="hs-identifier hs-var">getBufPos</span></a></span><span> </span><span class="annot"><span class="annottext">SrcLoc
</span><a href="#local-6989586621680973476"><span class="hs-identifier hs-var">l_end</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1251"></span><span>  </span><span id="local-6989586621680973473"><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973473"><span class="hs-identifier hs-var">nextDocs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LocRange
-&gt; HdkM [GenLocated SrcSpan HsDocString]
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a. LocRange -&gt; HdkM a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#inLocRange"><span class="hs-identifier hs-var">inLocRange</span></a></span><span> </span><span class="annot"><span class="annottext">LocRange
</span><a href="#local-6989586621680973475"><span class="hs-identifier hs-var">before_t</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkM [GenLocated SrcSpan HsDocString]
 -&gt; HdkM [GenLocated SrcSpan HsDocString])
-&gt; HdkM [GenLocated SrcSpan HsDocString]
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(PsLocated HdkComment -&gt; Maybe (GenLocated SrcSpan HsDocString))
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a. (PsLocated HdkComment -&gt; Maybe a) -&gt; HdkM [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#takeHdkComments"><span class="hs-identifier hs-var">takeHdkComments</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment -&gt; Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocNext"><span class="hs-identifier hs-var">mkDocNext</span></a></span><span>
</span><span id="line-1252"></span><span>  </span><span id="local-6989586621680973472"><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973472"><span class="hs-identifier hs-var">prevDocs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LocRange
-&gt; HdkM [GenLocated SrcSpan HsDocString]
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a. LocRange -&gt; HdkM a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#inLocRange"><span class="hs-identifier hs-var">inLocRange</span></a></span><span> </span><span class="annot"><span class="annottext">LocRange
</span><a href="#local-6989586621680973474"><span class="hs-identifier hs-var">after_t</span></a></span><span> </span><span class="annot"><span class="annottext">(HdkM [GenLocated SrcSpan HsDocString]
 -&gt; HdkM [GenLocated SrcSpan HsDocString])
-&gt; HdkM [GenLocated SrcSpan HsDocString]
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(PsLocated HdkComment -&gt; Maybe (GenLocated SrcSpan HsDocString))
-&gt; HdkM [GenLocated SrcSpan HsDocString]
forall a. (PsLocated HdkComment -&gt; Maybe a) -&gt; HdkM [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#takeHdkComments"><span class="hs-identifier hs-var">takeHdkComments</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment -&gt; Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocPrev"><span class="hs-identifier hs-var">mkDocPrev</span></a></span><span>
</span><span id="line-1253"></span><span>  </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#selectDocString"><span class="hs-identifier hs-var">selectDocString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973473"><span class="hs-identifier hs-var">nextDocs</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
-&gt; [GenLocated SrcSpan HsDocString]
-&gt; [GenLocated SrcSpan HsDocString]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973472"><span class="hs-identifier hs-var">prevDocs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1254"></span><span>
</span><span id="line-1255"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#appendHdkWarning"><span class="hs-identifier hs-type">appendHdkWarning</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkWarn"><span class="hs-identifier hs-type">HdkWarn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1256"></span><span id="appendHdkWarning"><span class="annot"><span class="annottext">appendHdkWarning :: HdkWarn -&gt; HdkM ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#appendHdkWarning"><span class="hs-identifier hs-var hs-var">appendHdkWarning</span></a></span></span><span> </span><span id="local-6989586621680973470"><span class="annot"><span class="annottext">HdkWarn
</span><a href="#local-6989586621680973470"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ReaderT LocRange (State HdkSt) () -&gt; HdkM ()
forall a. ReaderT LocRange (State HdkSt) a -&gt; HdkM a
</span><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-var">HdkM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LocRange -&gt; StateT HdkSt Identity ())
-&gt; ReaderT LocRange (State HdkSt) ()
forall r (m :: * -&gt; *) a. (r -&gt; m a) -&gt; ReaderT r m a
</span><a href="../../transformers/src/Control.Monad.Trans.Reader.html#ReaderT"><span class="hs-identifier hs-var">ReaderT</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">LocRange
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(HdkSt -&gt; HdkSt) -&gt; StateT HdkSt Identity ()
forall (m :: * -&gt; *) s. Monad m =&gt; (s -&gt; s) -&gt; StateT s m ()
</span><a href="../../transformers/src/Control.Monad.Trans.State.Strict.html#modify"><span class="hs-identifier hs-var">modify</span></a></span><span> </span><span class="annot"><span class="annottext">HdkSt -&gt; HdkSt
</span><a href="#local-6989586621680973467"><span class="hs-identifier hs-var">append_warn</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1257"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1258"></span><span>    </span><span id="local-6989586621680973467"><span class="annot"><span class="annottext">append_warn :: HdkSt -&gt; HdkSt
</span><a href="#local-6989586621680973467"><span class="hs-identifier hs-var hs-var">append_warn</span></a></span></span><span> </span><span id="local-6989586621680973466"><span class="annot"><span class="annottext">HdkSt
</span><a href="#local-6989586621680973466"><span class="hs-identifier hs-var">hdk_st</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HdkSt
</span><a href="#local-6989586621680973466"><span class="hs-identifier hs-var">hdk_st</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hdk_st_warnings :: [HdkWarn]
</span><a href="GHC.Parser.PostProcess.Haddock.html#hdk_st_warnings"><span class="hs-identifier hs-var">hdk_st_warnings</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HdkWarn
</span><a href="#local-6989586621680973470"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">HdkWarn -&gt; [HdkWarn] -&gt; [HdkWarn]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">HdkSt -&gt; [HdkWarn]
</span><a href="GHC.Parser.PostProcess.Haddock.html#hdk_st_warnings"><span class="hs-identifier hs-var hs-var">hdk_st_warnings</span></a></span><span> </span><span class="annot"><span class="annottext">HdkSt
</span><a href="#local-6989586621680973466"><span class="hs-identifier hs-var">hdk_st</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1259"></span><span>
</span><span id="line-1260"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#selectDocString"><span class="hs-identifier hs-type">selectDocString</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Doc.html#LHsDocString"><span class="hs-identifier hs-type">LHsDocString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Doc.html#LHsDocString"><span class="hs-identifier hs-type">LHsDocString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1261"></span><span id="selectDocString"><span class="annot"><span class="annottext">selectDocString :: [GenLocated SrcSpan HsDocString]
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="GHC.Parser.PostProcess.Haddock.html#selectDocString"><span class="hs-identifier hs-var hs-var">selectDocString</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="#local-6989586621680973465"><span class="hs-identifier hs-var">select</span></a></span><span> </span><span class="annot"><span class="annottext">([GenLocated SrcSpan HsDocString]
 -&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString)))
-&gt; ([GenLocated SrcSpan HsDocString]
    -&gt; [GenLocated SrcSpan HsDocString])
-&gt; [GenLocated SrcSpan HsDocString]
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan HsDocString -&gt; Bool)
-&gt; [GenLocated SrcSpan HsDocString]
-&gt; [GenLocated SrcSpan HsDocString]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterOut"><span class="hs-identifier hs-var">filterOut</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsDocString -&gt; Bool
</span><a href="GHC.Hs.Doc.html#isEmptyDocString"><span class="hs-identifier hs-var">isEmptyDocString</span></a></span><span> </span><span class="annot"><span class="annottext">(HsDocString -&gt; Bool)
-&gt; (GenLocated SrcSpan HsDocString -&gt; HsDocString)
-&gt; GenLocated SrcSpan HsDocString
-&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString -&gt; HsDocString
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1262"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1263"></span><span>    </span><span id="local-6989586621680973465"><span class="annot"><span class="annottext">select :: [GenLocated SrcSpan HsDocString]
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
</span><a href="#local-6989586621680973465"><span class="hs-identifier hs-var hs-var">select</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1264"></span><span>    </span><span class="annot"><a href="#local-6989586621680973465"><span class="hs-identifier hs-var">select</span></a></span><span> </span><span class="hs-special">[</span><span id="local-6989586621680973459"><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
</span><a href="#local-6989586621680973459"><span class="hs-identifier hs-var">doc</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
-&gt; HdkM (Maybe (GenLocated SrcSpan HsDocString))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
-&gt; Maybe (GenLocated SrcSpan HsDocString)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
</span><a href="#local-6989586621680973459"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1265"></span><span>    </span><span class="annot"><a href="#local-6989586621680973465"><span class="hs-identifier hs-var">select</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680973458"><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
</span><a href="#local-6989586621680973458"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680973457"><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973457"><span class="hs-identifier hs-var">extra_docs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1266"></span><span>      </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString] -&gt; HdkM ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#reportExtraDocs"><span class="hs-identifier hs-var">reportExtraDocs</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan HsDocString]
</span><a href="#local-6989586621680973457"><span class="hs-identifier hs-var">extra_docs</span></a></span><span>
</span><span id="line-1267"></span><span>      </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
-&gt; Maybe (GenLocated SrcSpan HsDocString)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
</span><a href="#local-6989586621680973458"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1268"></span><span>
</span><span id="line-1269"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#reportExtraDocs"><span class="hs-identifier hs-type">reportExtraDocs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Doc.html#LHsDocString"><span class="hs-identifier hs-type">LHsDocString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#HdkM"><span class="hs-identifier hs-type">HdkM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1270"></span><span id="reportExtraDocs"><span class="annot"><span class="annottext">reportExtraDocs :: [GenLocated SrcSpan HsDocString] -&gt; HdkM ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#reportExtraDocs"><span class="hs-identifier hs-var hs-var">reportExtraDocs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1271"></span><span>  </span><span class="annot"><span class="annottext">(GenLocated SrcSpan HsDocString -&gt; HdkM ())
-&gt; [GenLocated SrcSpan HsDocString] -&gt; HdkM ()
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Foldable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f ()
</span><a href="../../base/src/Data.Foldable.html#traverse_"><span class="hs-identifier hs-var">traverse_</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680973456"><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
</span><a href="#local-6989586621680973456"><span class="hs-identifier hs-var">extra_doc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HdkWarn -&gt; HdkM ()
</span><a href="GHC.Parser.PostProcess.Haddock.html#appendHdkWarning"><span class="hs-identifier hs-var">appendHdkWarning</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString -&gt; HdkWarn
</span><a href="GHC.Parser.PostProcess.Haddock.html#HdkWarnExtraComment"><span class="hs-identifier hs-var">HdkWarnExtraComment</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
</span><a href="#local-6989586621680973456"><span class="hs-identifier hs-var">extra_doc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1272"></span><span>
</span><span id="line-1273"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
*      Matching functions for extracting documentation comments        *
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1278"></span><span>
</span><span id="line-1279"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mkDocHsDecl"><span class="hs-identifier hs-type">mkDocHsDecl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#LayoutInfo"><span class="hs-identifier hs-type">LayoutInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#LHsDecl"><span class="hs-identifier hs-type">LHsDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1280"></span><span id="mkDocHsDecl"><span class="annot"><span class="annottext">mkDocHsDecl :: LayoutInfo -&gt; PsLocated HdkComment -&gt; Maybe (LHsDecl GhcPs)
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocHsDecl"><span class="hs-identifier hs-var hs-var">mkDocHsDecl</span></a></span></span><span> </span><span id="local-6989586621680973455"><span class="annot"><span class="annottext">LayoutInfo
</span><a href="#local-6989586621680973455"><span class="hs-identifier hs-var">layout_info</span></a></span></span><span> </span><span id="local-6989586621680973454"><span class="annot"><span class="annottext">PsLocated HdkComment
</span><a href="#local-6989586621680973454"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DocDecl -&gt; HsDecl GhcPs) -&gt; LDocDecl -&gt; LHsDecl GhcPs
forall a b l. (a -&gt; b) -&gt; GenLocated l a -&gt; GenLocated l b
</span><a href="GHC.Types.SrcLoc.html#mapLoc"><span class="hs-identifier hs-var">mapLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XDocD GhcPs -&gt; DocDecl -&gt; HsDecl GhcPs
forall p. XDocD p -&gt; DocDecl -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#DocD"><span class="hs-identifier hs-var">DocD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XDocD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(LDocDecl -&gt; LHsDecl GhcPs)
-&gt; Maybe LDocDecl -&gt; Maybe (LHsDecl GhcPs)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">LayoutInfo -&gt; PsLocated HdkComment -&gt; Maybe LDocDecl
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocDecl"><span class="hs-identifier hs-var">mkDocDecl</span></a></span><span> </span><span class="annot"><span class="annottext">LayoutInfo
</span><a href="#local-6989586621680973455"><span class="hs-identifier hs-var">layout_info</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment
</span><a href="#local-6989586621680973454"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-1281"></span><span>
</span><span id="line-1282"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mkDocDecl"><span class="hs-identifier hs-type">mkDocDecl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#LayoutInfo"><span class="hs-identifier hs-type">LayoutInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#LDocDecl"><span class="hs-identifier hs-type">LDocDecl</span></a></span><span>
</span><span id="line-1283"></span><span id="mkDocDecl"><span class="annot"><span class="annottext">mkDocDecl :: LayoutInfo -&gt; PsLocated HdkComment -&gt; Maybe LDocDecl
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocDecl"><span class="hs-identifier hs-var hs-var">mkDocDecl</span></a></span></span><span> </span><span id="local-6989586621680973450"><span class="annot"><span class="annottext">LayoutInfo
</span><a href="#local-6989586621680973450"><span class="hs-identifier hs-var">layout_info</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973449"><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973449"><span class="hs-identifier hs-var">l_comment</span></a></span></span><span> </span><span id="local-6989586621680973448"><span class="annot"><span class="annottext">HdkComment
</span><a href="#local-6989586621680973448"><span class="hs-identifier hs-var">hdk_comment</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1284"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680973447"><span class="hs-identifier hs-var">indent_mismatch</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe LDocDecl
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1285"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1286"></span><span>    </span><span class="annot"><span class="annottext">LDocDecl -&gt; Maybe LDocDecl
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(LDocDecl -&gt; Maybe LDocDecl) -&gt; LDocDecl -&gt; Maybe LDocDecl
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; DocDecl -&gt; LDocDecl
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PsSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#mkSrcSpanPs"><span class="hs-identifier hs-var">mkSrcSpanPs</span></a></span><span> </span><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973449"><span class="hs-identifier hs-var">l_comment</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(DocDecl -&gt; LDocDecl) -&gt; DocDecl -&gt; LDocDecl
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1287"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HdkComment
</span><a href="#local-6989586621680973448"><span class="hs-identifier hs-var">hdk_comment</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1288"></span><span>        </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkCommentNext"><span class="hs-identifier hs-type">HdkCommentNext</span></a></span><span> </span><span id="local-6989586621680973445"><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973445"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HsDocString -&gt; DocDecl
</span><a href="GHC.Hs.Decls.html#DocCommentNext"><span class="hs-identifier hs-var">DocCommentNext</span></a></span><span> </span><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973445"><span class="hs-identifier hs-var">doc</span></a></span><span>
</span><span id="line-1289"></span><span>        </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkCommentPrev"><span class="hs-identifier hs-type">HdkCommentPrev</span></a></span><span> </span><span id="local-6989586621680973442"><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973442"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HsDocString -&gt; DocDecl
</span><a href="GHC.Hs.Decls.html#DocCommentPrev"><span class="hs-identifier hs-var">DocCommentPrev</span></a></span><span> </span><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973442"><span class="hs-identifier hs-var">doc</span></a></span><span>
</span><span id="line-1290"></span><span>        </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkCommentNamed"><span class="hs-identifier hs-type">HdkCommentNamed</span></a></span><span> </span><span id="local-6989586621680973439"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680973439"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621680973438"><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973438"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; HsDocString -&gt; DocDecl
</span><a href="GHC.Hs.Decls.html#DocCommentNamed"><span class="hs-identifier hs-var">DocCommentNamed</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680973439"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973438"><span class="hs-identifier hs-var">doc</span></a></span><span>
</span><span id="line-1291"></span><span>        </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkCommentSection"><span class="hs-identifier hs-type">HdkCommentSection</span></a></span><span> </span><span id="local-6989586621680973435"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973435"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680973434"><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973434"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; HsDocString -&gt; DocDecl
</span><a href="GHC.Hs.Decls.html#DocGroup"><span class="hs-identifier hs-var">DocGroup</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973435"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973434"><span class="hs-identifier hs-var">doc</span></a></span><span>
</span><span id="line-1292"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1293"></span><span>    </span><span class="hs-comment">--  'indent_mismatch' checks if the documentation comment has the exact</span><span>
</span><span id="line-1294"></span><span>    </span><span class="hs-comment">--  indentation level expected by the parent node.</span><span>
</span><span id="line-1295"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-1296"></span><span>    </span><span class="hs-comment">--  For example, when extracting documentation comments between class</span><span>
</span><span id="line-1297"></span><span>    </span><span class="hs-comment">--  method declarations, there are three cases to consider:</span><span>
</span><span id="line-1298"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-1299"></span><span>    </span><span class="hs-comment">--  1. Indent matches (indent_mismatch=False):</span><span>
</span><span id="line-1300"></span><span>    </span><span class="hs-comment">--         class C a where</span><span>
</span><span id="line-1301"></span><span>    </span><span class="hs-comment">--           f :: a -&gt; a</span><span>
</span><span id="line-1302"></span><span>    </span><span class="hs-comment">--           -- ^ doc on f</span><span>
</span><span id="line-1303"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-1304"></span><span>    </span><span class="hs-comment">--  2. Indented too much (indent_mismatch=True):</span><span>
</span><span id="line-1305"></span><span>    </span><span class="hs-comment">--         class C a where</span><span>
</span><span id="line-1306"></span><span>    </span><span class="hs-comment">--           f :: a -&gt; a</span><span>
</span><span id="line-1307"></span><span>    </span><span class="hs-comment">--             -- ^ indent mismatch</span><span>
</span><span id="line-1308"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-1309"></span><span>    </span><span class="hs-comment">--  3. Indented too little (indent_mismatch=True):</span><span>
</span><span id="line-1310"></span><span>    </span><span class="hs-comment">--         class C a where</span><span>
</span><span id="line-1311"></span><span>    </span><span class="hs-comment">--           f :: a -&gt; a</span><span>
</span><span id="line-1312"></span><span>    </span><span class="hs-comment">--         -- ^ indent mismatch</span><span>
</span><span id="line-1313"></span><span>    </span><span id="local-6989586621680973447"><span class="annot"><span class="annottext">indent_mismatch :: Bool
</span><a href="#local-6989586621680973447"><span class="hs-identifier hs-var hs-var">indent_mismatch</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">LayoutInfo
</span><a href="#local-6989586621680973450"><span class="hs-identifier hs-var">layout_info</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1314"></span><span>      </span><span class="annot"><span class="annottext">LayoutInfo
</span><a href="GHC.Types.SrcLoc.html#NoLayoutInfo"><span class="hs-identifier hs-var">NoLayoutInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1315"></span><span>      </span><span class="annot"><span class="annottext">LayoutInfo
</span><a href="GHC.Types.SrcLoc.html#ExplicitBraces"><span class="hs-identifier hs-var">ExplicitBraces</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1316"></span><span>      </span><span class="annot"><a href="GHC.Types.SrcLoc.html#VirtualBraces"><span class="hs-identifier hs-type">VirtualBraces</span></a></span><span> </span><span id="local-6989586621680973432"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973432"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973432"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">RealSrcSpan -&gt; Int
</span><a href="GHC.Types.SrcLoc.html#srcSpanStartCol"><span class="hs-identifier hs-var">srcSpanStartCol</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PsSpan -&gt; RealSrcSpan
</span><a href="GHC.Types.SrcLoc.html#psRealSpan"><span class="hs-identifier hs-var hs-var">psRealSpan</span></a></span><span> </span><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973449"><span class="hs-identifier hs-var">l_comment</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1317"></span><span>
</span><span id="line-1318"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mkDocIE"><span class="hs-identifier hs-type">mkDocIE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LIE"><span class="hs-identifier hs-type">LIE</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1319"></span><span id="mkDocIE"><span class="annot"><span class="annottext">mkDocIE :: PsLocated HdkComment -&gt; Maybe (LIE GhcPs)
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocIE"><span class="hs-identifier hs-var hs-var">mkDocIE</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973430"><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973430"><span class="hs-identifier hs-var">l_comment</span></a></span></span><span> </span><span id="local-6989586621680973429"><span class="annot"><span class="annottext">HdkComment
</span><a href="#local-6989586621680973429"><span class="hs-identifier hs-var">hdk_comment</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1320"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HdkComment
</span><a href="#local-6989586621680973429"><span class="hs-identifier hs-var">hdk_comment</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1321"></span><span>    </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkCommentSection"><span class="hs-identifier hs-type">HdkCommentSection</span></a></span><span> </span><span id="local-6989586621680973428"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973428"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680973427"><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973427"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LIE GhcPs -&gt; Maybe (LIE GhcPs)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(LIE GhcPs -&gt; Maybe (LIE GhcPs)) -&gt; LIE GhcPs -&gt; Maybe (LIE GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; IE GhcPs -&gt; LIE GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973426"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XIEGroup GhcPs -&gt; Int -&gt; HsDocString -&gt; IE GhcPs
forall pass. XIEGroup pass -&gt; Int -&gt; HsDocString -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEGroup"><span class="hs-identifier hs-var">IEGroup</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEGroup GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973428"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973427"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1322"></span><span>    </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkCommentNamed"><span class="hs-identifier hs-type">HdkCommentNamed</span></a></span><span> </span><span id="local-6989586621680973424"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680973424"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621680973423"><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973423"><span class="hs-identifier hs-var">_doc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LIE GhcPs -&gt; Maybe (LIE GhcPs)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(LIE GhcPs -&gt; Maybe (LIE GhcPs)) -&gt; LIE GhcPs -&gt; Maybe (LIE GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; IE GhcPs -&gt; LIE GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973426"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XIEDocNamed GhcPs -&gt; String -&gt; IE GhcPs
forall pass. XIEDocNamed pass -&gt; String -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEDocNamed"><span class="hs-identifier hs-var">IEDocNamed</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEDocNamed GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680973424"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1323"></span><span>    </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkCommentNext"><span class="hs-identifier hs-type">HdkCommentNext</span></a></span><span> </span><span id="local-6989586621680973421"><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973421"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LIE GhcPs -&gt; Maybe (LIE GhcPs)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(LIE GhcPs -&gt; Maybe (LIE GhcPs)) -&gt; LIE GhcPs -&gt; Maybe (LIE GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; IE GhcPs -&gt; LIE GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680973426"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XIEDoc GhcPs -&gt; HsDocString -&gt; IE GhcPs
forall pass. XIEDoc pass -&gt; HsDocString -&gt; IE pass
</span><a href="GHC.Hs.ImpExp.html#IEDoc"><span class="hs-identifier hs-var">IEDoc</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XIEDoc GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973421"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1324"></span><span>    </span><span class="annot"><span class="annottext">HdkComment
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (LIE GhcPs)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1325"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680973426"><span class="annot"><span class="annottext">l :: SrcSpan
</span><a href="#local-6989586621680973426"><span class="hs-identifier hs-var hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PsSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#mkSrcSpanPs"><span class="hs-identifier hs-var">mkSrcSpanPs</span></a></span><span> </span><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973430"><span class="hs-identifier hs-var">l_comment</span></a></span><span>
</span><span id="line-1326"></span><span>
</span><span id="line-1327"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mkDocNext"><span class="hs-identifier hs-type">mkDocNext</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Doc.html#LHsDocString"><span class="hs-identifier hs-type">LHsDocString</span></a></span><span>
</span><span id="line-1328"></span><span id="mkDocNext"><span class="annot"><span class="annottext">mkDocNext :: PsLocated HdkComment -&gt; Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocNext"><span class="hs-identifier hs-var hs-var">mkDocNext</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973419"><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973419"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkCommentNext"><span class="hs-identifier hs-type">HdkCommentNext</span></a></span><span> </span><span id="local-6989586621680973418"><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973418"><span class="hs-identifier hs-var">doc</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
-&gt; Maybe (GenLocated SrcSpan HsDocString)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan HsDocString
 -&gt; Maybe (GenLocated SrcSpan HsDocString))
-&gt; GenLocated SrcSpan HsDocString
-&gt; Maybe (GenLocated SrcSpan HsDocString)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HsDocString -&gt; GenLocated SrcSpan HsDocString
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PsSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#mkSrcSpanPs"><span class="hs-identifier hs-var">mkSrcSpanPs</span></a></span><span> </span><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973419"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973418"><span class="hs-identifier hs-var">doc</span></a></span><span>
</span><span id="line-1329"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mkDocNext"><span class="hs-identifier hs-var">mkDocNext</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1330"></span><span>
</span><span id="line-1331"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mkDocPrev"><span class="hs-identifier hs-type">mkDocPrev</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#PsLocated"><span class="hs-identifier hs-type">PsLocated</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkComment"><span class="hs-identifier hs-type">HdkComment</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Doc.html#LHsDocString"><span class="hs-identifier hs-type">LHsDocString</span></a></span><span>
</span><span id="line-1332"></span><span id="mkDocPrev"><span class="annot"><span class="annottext">mkDocPrev :: PsLocated HdkComment -&gt; Maybe (GenLocated SrcSpan HsDocString)
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkDocPrev"><span class="hs-identifier hs-var hs-var">mkDocPrev</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680973417"><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973417"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.Lexer.html#HdkCommentPrev"><span class="hs-identifier hs-type">HdkCommentPrev</span></a></span><span> </span><span id="local-6989586621680973416"><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973416"><span class="hs-identifier hs-var">doc</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
-&gt; Maybe (GenLocated SrcSpan HsDocString)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan HsDocString
 -&gt; Maybe (GenLocated SrcSpan HsDocString))
-&gt; GenLocated SrcSpan HsDocString
-&gt; Maybe (GenLocated SrcSpan HsDocString)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HsDocString -&gt; GenLocated SrcSpan HsDocString
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PsSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#mkSrcSpanPs"><span class="hs-identifier hs-var">mkSrcSpanPs</span></a></span><span> </span><span class="annot"><span class="annottext">PsSpan
</span><a href="#local-6989586621680973417"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HsDocString
</span><a href="#local-6989586621680973416"><span class="hs-identifier hs-var">doc</span></a></span><span>
</span><span id="line-1333"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mkDocPrev"><span class="hs-identifier hs-var">mkDocPrev</span></a></span><span> </span><span class="annot"><span class="annottext">PsLocated HdkComment
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1334"></span><span>
</span><span id="line-1335"></span><span>
</span><span id="line-1336"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
*                   LocRange: a location range                         *
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1341"></span><span>
</span><span id="line-1342"></span><span class="hs-comment">-- A location range for extracting documentation comments.</span><span>
</span><span id="line-1343"></span><span class="hs-keyword">data</span><span> </span><span id="LocRange"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-var">LocRange</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1344"></span><span>  </span><span id="LocRange"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-var">LocRange</span></a></span></span><span>
</span><span id="line-1345"></span><span>    </span><span class="hs-special">{</span><span> </span><span id="loc_range_from"><span class="annot"><span class="annottext">LocRange -&gt; LowerLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#loc_range_from"><span class="hs-identifier hs-var hs-var">loc_range_from</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LowerLocBound"><span class="hs-identifier hs-type">LowerLocBound</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1346"></span><span>      </span><span id="loc_range_to"><span class="annot"><span class="annottext">LocRange -&gt; UpperLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#loc_range_to"><span class="hs-identifier hs-var hs-var">loc_range_to</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#UpperLocBound"><span class="hs-identifier hs-type">UpperLocBound</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1347"></span><span>      </span><span id="loc_range_col"><span class="annot"><span class="annottext">LocRange -&gt; ColumnBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#loc_range_col"><span class="hs-identifier hs-var hs-var">loc_range_col</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ColumnBound"><span class="hs-identifier hs-type">ColumnBound</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1348"></span><span>
</span><span id="line-1349"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680973409"><span id="local-6989586621680973411"><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier hs-type">Semigroup</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-type">LocRange</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1350"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-type">LocRange</span></a></span><span> </span><span id="local-6989586621680973405"><span class="annot"><span class="annottext">LowerLocBound
</span><a href="#local-6989586621680973405"><span class="hs-identifier hs-var">from1</span></a></span></span><span> </span><span id="local-6989586621680973404"><span class="annot"><span class="annottext">UpperLocBound
</span><a href="#local-6989586621680973404"><span class="hs-identifier hs-var">to1</span></a></span></span><span> </span><span id="local-6989586621680973403"><span class="annot"><span class="annottext">ColumnBound
</span><a href="#local-6989586621680973403"><span class="hs-identifier hs-var">col1</span></a></span></span><span> </span><span id="local-6989586621680973402"><span class="annot"><span class="annottext">&lt;&gt; :: LocRange -&gt; LocRange -&gt; LocRange
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;&gt;</span></a></span></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-type">LocRange</span></a></span><span> </span><span id="local-6989586621680973401"><span class="annot"><span class="annottext">LowerLocBound
</span><a href="#local-6989586621680973401"><span class="hs-identifier hs-var">from2</span></a></span></span><span> </span><span id="local-6989586621680973400"><span class="annot"><span class="annottext">UpperLocBound
</span><a href="#local-6989586621680973400"><span class="hs-identifier hs-var">to2</span></a></span></span><span> </span><span id="local-6989586621680973399"><span class="annot"><span class="annottext">ColumnBound
</span><a href="#local-6989586621680973399"><span class="hs-identifier hs-var">col2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1351"></span><span>    </span><span class="annot"><span class="annottext">LowerLocBound -&gt; UpperLocBound -&gt; ColumnBound -&gt; LocRange
</span><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-var">LocRange</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LowerLocBound
</span><a href="#local-6989586621680973405"><span class="hs-identifier hs-var">from1</span></a></span><span> </span><span class="annot"><span class="annottext">LowerLocBound -&gt; LowerLocBound -&gt; LowerLocBound
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">LowerLocBound
</span><a href="#local-6989586621680973401"><span class="hs-identifier hs-var">from2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UpperLocBound
</span><a href="#local-6989586621680973404"><span class="hs-identifier hs-var">to1</span></a></span><span> </span><span class="annot"><span class="annottext">UpperLocBound -&gt; UpperLocBound -&gt; UpperLocBound
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">UpperLocBound
</span><a href="#local-6989586621680973400"><span class="hs-identifier hs-var">to2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ColumnBound
</span><a href="#local-6989586621680973403"><span class="hs-identifier hs-var">col1</span></a></span><span> </span><span class="annot"><span class="annottext">ColumnBound -&gt; ColumnBound -&gt; ColumnBound
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ColumnBound
</span><a href="#local-6989586621680973399"><span class="hs-identifier hs-var">col2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1352"></span><span>
</span><span id="line-1353"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680973392"><span id="local-6989586621680973394"><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-type">LocRange</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1354"></span><span>  </span><span id="local-6989586621680973388"><span class="annot"><span class="annottext">mempty :: LocRange
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var hs-var hs-var hs-var">mempty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LowerLocBound -&gt; UpperLocBound -&gt; ColumnBound -&gt; LocRange
</span><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-var">LocRange</span></a></span><span> </span><span class="annot"><span class="annottext">LowerLocBound
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span> </span><span class="annot"><span class="annottext">UpperLocBound
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span> </span><span class="annot"><span class="annottext">ColumnBound
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span>
</span><span id="line-1355"></span><span>
</span><span id="line-1356"></span><span class="hs-comment">-- The location range from the specified position to the end of the file.</span><span>
</span><span id="line-1357"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#locRangeFrom"><span class="hs-identifier hs-type">locRangeFrom</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#BufPos"><span class="hs-identifier hs-type">BufPos</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-type">LocRange</span></a></span><span>
</span><span id="line-1358"></span><span id="locRangeFrom"><span class="annot"><span class="annottext">locRangeFrom :: Maybe BufPos -&gt; LocRange
</span><a href="GHC.Parser.PostProcess.Haddock.html#locRangeFrom"><span class="hs-identifier hs-var hs-var">locRangeFrom</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680973387"><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973387"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LocRange
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">loc_range_from :: LowerLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#loc_range_from"><span class="hs-identifier hs-var">loc_range_from</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BufPos -&gt; LowerLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#StartLoc"><span class="hs-identifier hs-var">StartLoc</span></a></span><span> </span><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973387"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1359"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#locRangeFrom"><span class="hs-identifier hs-var">locRangeFrom</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BufPos
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LocRange
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span>
</span><span id="line-1360"></span><span>
</span><span id="line-1361"></span><span class="hs-comment">-- The location range from the start of the file to the specified position.</span><span>
</span><span id="line-1362"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#locRangeTo"><span class="hs-identifier hs-type">locRangeTo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#BufPos"><span class="hs-identifier hs-type">BufPos</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LocRange"><span class="hs-identifier hs-type">LocRange</span></a></span><span>
</span><span id="line-1363"></span><span id="locRangeTo"><span class="annot"><span class="annottext">locRangeTo :: Maybe BufPos -&gt; LocRange
</span><a href="GHC.Parser.PostProcess.Haddock.html#locRangeTo"><span class="hs-identifier hs-var hs-var">locRangeTo</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680973386"><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973386"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LocRange
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">loc_range_to :: UpperLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#loc_range_to"><span class="hs-identifier hs-var">loc_range_to</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BufPos -&gt; UpperLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#EndLoc"><span class="hs-identifier hs-var">EndLoc</span></a></span><span> </span><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973386"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1364"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#locRangeTo"><span class="hs-identifier hs-var">locRangeTo</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe BufPos
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LocRange
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span>
</span><span id="line-1365"></span><span>
</span><span id="line-1366"></span><span class="hs-comment">-- Represents a predicate on BufPos:</span><span>
</span><span id="line-1367"></span><span class="hs-comment">--</span><span>
</span><span id="line-1368"></span><span class="hs-comment">--   LowerLocBound |   BufPos -&gt; Bool</span><span>
</span><span id="line-1369"></span><span class="hs-comment">--   --------------+-----------------</span><span>
</span><span id="line-1370"></span><span class="hs-comment">--   StartOfFile   |   const True</span><span>
</span><span id="line-1371"></span><span class="hs-comment">--   StartLoc p    |   (&gt;= p)</span><span>
</span><span id="line-1372"></span><span class="hs-comment">--</span><span>
</span><span id="line-1373"></span><span class="hs-comment">--  The semigroup instance corresponds to (&amp;&amp;).</span><span>
</span><span id="line-1374"></span><span class="hs-comment">--</span><span>
</span><span id="line-1375"></span><span class="hs-comment">--  We don't use the  BufPos -&gt; Bool  representation</span><span>
</span><span id="line-1376"></span><span class="hs-comment">--  as it would lead to redundant checks.</span><span>
</span><span id="line-1377"></span><span class="hs-comment">--</span><span>
</span><span id="line-1378"></span><span class="hs-comment">--  That is, instead of</span><span>
</span><span id="line-1379"></span><span class="hs-comment">--</span><span>
</span><span id="line-1380"></span><span class="hs-comment">--      (pos &gt;= 20) &amp;&amp; (pos &gt;= 30) &amp;&amp; (pos &gt;= 40)</span><span>
</span><span id="line-1381"></span><span class="hs-comment">--</span><span>
</span><span id="line-1382"></span><span class="hs-comment">--  We'd rather only do the (&gt;=40) check. So we reify the predicate to make</span><span>
</span><span id="line-1383"></span><span class="hs-comment">--  sure we only check for the most restrictive bound.</span><span>
</span><span id="line-1384"></span><span class="hs-keyword">data</span><span> </span><span id="LowerLocBound"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LowerLocBound"><span class="hs-identifier hs-var">LowerLocBound</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="StartOfFile"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#StartOfFile"><span class="hs-identifier hs-var">StartOfFile</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="StartLoc"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#StartLoc"><span class="hs-identifier hs-var">StartLoc</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.SrcLoc.html#BufPos"><span class="hs-identifier hs-type">BufPos</span></a></span><span>
</span><span id="line-1385"></span><span>
</span><span id="line-1386"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680973381"><span id="local-6989586621680973383"><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier hs-type">Semigroup</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LowerLocBound"><span class="hs-identifier hs-type">LowerLocBound</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1387"></span><span>  </span><span class="annot"><span class="annottext">LowerLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#StartOfFile"><span class="hs-identifier hs-var">StartOfFile</span></a></span><span> </span><span id="local-6989586621680973379"><span class="annot"><span class="annottext">&lt;&gt; :: LowerLocBound -&gt; LowerLocBound -&gt; LowerLocBound
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;&gt;</span></a></span></span><span> </span><span id="local-6989586621680973378"><span class="annot"><span class="annottext">LowerLocBound
</span><a href="#local-6989586621680973378"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LowerLocBound
</span><a href="#local-6989586621680973378"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1388"></span><span>  </span><span id="local-6989586621680973377"><span class="annot"><span class="annottext">LowerLocBound
</span><a href="#local-6989586621680973377"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">LowerLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#StartOfFile"><span class="hs-identifier hs-var">StartOfFile</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LowerLocBound
</span><a href="#local-6989586621680973377"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1389"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#StartLoc"><span class="hs-identifier hs-type">StartLoc</span></a></span><span> </span><span id="local-6989586621680973376"><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973376"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#StartLoc"><span class="hs-identifier hs-type">StartLoc</span></a></span><span> </span><span id="local-6989586621680973375"><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973375"><span class="hs-identifier hs-var">l2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BufPos -&gt; LowerLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#StartLoc"><span class="hs-identifier hs-var">StartLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BufPos -&gt; BufPos -&gt; BufPos
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier hs-var">max</span></span><span> </span><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973376"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973375"><span class="hs-identifier hs-var">l2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1390"></span><span>
</span><span id="line-1391"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680973367"><span id="local-6989586621680973369"><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#LowerLocBound"><span class="hs-identifier hs-type">LowerLocBound</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1392"></span><span>  </span><span id="local-6989586621680973366"><span class="annot"><span class="annottext">mempty :: LowerLocBound
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var hs-var hs-var hs-var">mempty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LowerLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#StartOfFile"><span class="hs-identifier hs-var">StartOfFile</span></a></span><span>
</span><span id="line-1393"></span><span>
</span><span id="line-1394"></span><span class="hs-comment">-- Represents a predicate on BufPos:</span><span>
</span><span id="line-1395"></span><span class="hs-comment">--</span><span>
</span><span id="line-1396"></span><span class="hs-comment">--   UpperLocBound |   BufPos -&gt; Bool</span><span>
</span><span id="line-1397"></span><span class="hs-comment">--   --------------+-----------------</span><span>
</span><span id="line-1398"></span><span class="hs-comment">--   EndOfFile     |   const True</span><span>
</span><span id="line-1399"></span><span class="hs-comment">--   EndLoc p      |   (&lt;= p)</span><span>
</span><span id="line-1400"></span><span class="hs-comment">--</span><span>
</span><span id="line-1401"></span><span class="hs-comment">--  The semigroup instance corresponds to (&amp;&amp;).</span><span>
</span><span id="line-1402"></span><span class="hs-comment">--</span><span>
</span><span id="line-1403"></span><span class="hs-comment">--  We don't use the  BufPos -&gt; Bool  representation</span><span>
</span><span id="line-1404"></span><span class="hs-comment">--  as it would lead to redundant checks.</span><span>
</span><span id="line-1405"></span><span class="hs-comment">--</span><span>
</span><span id="line-1406"></span><span class="hs-comment">--  That is, instead of</span><span>
</span><span id="line-1407"></span><span class="hs-comment">--</span><span>
</span><span id="line-1408"></span><span class="hs-comment">--      (pos &lt;= 40) &amp;&amp; (pos &lt;= 30) &amp;&amp; (pos &lt;= 20)</span><span>
</span><span id="line-1409"></span><span class="hs-comment">--</span><span>
</span><span id="line-1410"></span><span class="hs-comment">--  We'd rather only do the (&lt;=20) check. So we reify the predicate to make</span><span>
</span><span id="line-1411"></span><span class="hs-comment">--  sure we only check for the most restrictive bound.</span><span>
</span><span id="line-1412"></span><span class="hs-keyword">data</span><span> </span><span id="UpperLocBound"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#UpperLocBound"><span class="hs-identifier hs-var">UpperLocBound</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="EndOfFile"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#EndOfFile"><span class="hs-identifier hs-var">EndOfFile</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="EndLoc"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#EndLoc"><span class="hs-identifier hs-var">EndLoc</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.SrcLoc.html#BufPos"><span class="hs-identifier hs-type">BufPos</span></a></span><span>
</span><span id="line-1413"></span><span>
</span><span id="line-1414"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680973361"><span id="local-6989586621680973363"><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier hs-type">Semigroup</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#UpperLocBound"><span class="hs-identifier hs-type">UpperLocBound</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1415"></span><span>  </span><span class="annot"><span class="annottext">UpperLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#EndOfFile"><span class="hs-identifier hs-var">EndOfFile</span></a></span><span> </span><span id="local-6989586621680973359"><span class="annot"><span class="annottext">&lt;&gt; :: UpperLocBound -&gt; UpperLocBound -&gt; UpperLocBound
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;&gt;</span></a></span></span><span> </span><span id="local-6989586621680973358"><span class="annot"><span class="annottext">UpperLocBound
</span><a href="#local-6989586621680973358"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UpperLocBound
</span><a href="#local-6989586621680973358"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1416"></span><span>  </span><span id="local-6989586621680973357"><span class="annot"><span class="annottext">UpperLocBound
</span><a href="#local-6989586621680973357"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">UpperLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#EndOfFile"><span class="hs-identifier hs-var">EndOfFile</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UpperLocBound
</span><a href="#local-6989586621680973357"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1417"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#EndLoc"><span class="hs-identifier hs-type">EndLoc</span></a></span><span> </span><span id="local-6989586621680973356"><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973356"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#EndLoc"><span class="hs-identifier hs-type">EndLoc</span></a></span><span> </span><span id="local-6989586621680973355"><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973355"><span class="hs-identifier hs-var">l2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BufPos -&gt; UpperLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#EndLoc"><span class="hs-identifier hs-var">EndLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BufPos -&gt; BufPos -&gt; BufPos
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier hs-var">min</span></span><span> </span><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973356"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">BufPos
</span><a href="#local-6989586621680973355"><span class="hs-identifier hs-var">l2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1418"></span><span>
</span><span id="line-1419"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680973347"><span id="local-6989586621680973349"><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#UpperLocBound"><span class="hs-identifier hs-type">UpperLocBound</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1420"></span><span>  </span><span id="local-6989586621680973346"><span class="annot"><span class="annottext">mempty :: UpperLocBound
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var hs-var hs-var hs-var">mempty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UpperLocBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#EndOfFile"><span class="hs-identifier hs-var">EndOfFile</span></a></span><span>
</span><span id="line-1421"></span><span>
</span><span id="line-1422"></span><span class="hs-comment">-- | Represents a predicate on the column number.</span><span>
</span><span id="line-1423"></span><span class="hs-comment">--</span><span>
</span><span id="line-1424"></span><span class="hs-comment">--   ColumnBound   |   Int -&gt; Bool</span><span>
</span><span id="line-1425"></span><span class="hs-comment">--   --------------+-----------------</span><span>
</span><span id="line-1426"></span><span class="hs-comment">--   ColumnFrom n  |   (&gt;=n)</span><span>
</span><span id="line-1427"></span><span class="hs-comment">--</span><span>
</span><span id="line-1428"></span><span class="hs-comment">--  The semigroup instance corresponds to (&amp;&amp;).</span><span>
</span><span id="line-1429"></span><span class="hs-comment">--</span><span>
</span><span id="line-1430"></span><span class="hs-keyword">newtype</span><span> </span><span id="ColumnBound"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ColumnBound"><span class="hs-identifier hs-var">ColumnBound</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="ColumnFrom"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ColumnFrom"><span class="hs-identifier hs-var">ColumnFrom</span></a></span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-comment">-- n &gt;= GHC.Types.SrcLoc.leftmostColumn</span><span>
</span><span id="line-1431"></span><span>
</span><span id="line-1432"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680973341"><span id="local-6989586621680973343"><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier hs-type">Semigroup</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ColumnBound"><span class="hs-identifier hs-type">ColumnBound</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1433"></span><span>  </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ColumnFrom"><span class="hs-identifier hs-type">ColumnFrom</span></a></span><span> </span><span id="local-6989586621680973339"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973339"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680973338"><span class="annot"><span class="annottext">&lt;&gt; :: ColumnBound -&gt; ColumnBound -&gt; ColumnBound
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;&gt;</span></a></span></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ColumnFrom"><span class="hs-identifier hs-type">ColumnFrom</span></a></span><span> </span><span id="local-6989586621680973337"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973337"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ColumnBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#ColumnFrom"><span class="hs-identifier hs-var">ColumnFrom</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier hs-var">max</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973339"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680973337"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1434"></span><span>
</span><span id="line-1435"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680973330"><span id="local-6989586621680973332"><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#ColumnBound"><span class="hs-identifier hs-type">ColumnBound</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1436"></span><span>  </span><span id="local-6989586621680973329"><span class="annot"><span class="annottext">mempty :: ColumnBound
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var hs-var hs-var hs-var">mempty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ColumnBound
</span><a href="GHC.Parser.PostProcess.Haddock.html#ColumnFrom"><span class="hs-identifier hs-var">ColumnFrom</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="GHC.Types.SrcLoc.html#leftmostColumn"><span class="hs-identifier hs-var">leftmostColumn</span></a></span><span>
</span><span id="line-1437"></span><span>
</span><span id="line-1438"></span><span>
</span><span id="line-1439"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
*                   AST manipulation utilities                         *
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1444"></span><span>
</span><span id="line-1445"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mkLHsDocTy"><span class="hs-identifier hs-type">mkLHsDocTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#LHsType"><span class="hs-identifier hs-type">LHsType</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Doc.html#LHsDocString"><span class="hs-identifier hs-type">LHsDocString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#LHsType"><span class="hs-identifier hs-type">LHsType</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-1446"></span><span id="mkLHsDocTy"><span class="annot"><span class="annottext">mkLHsDocTy :: LHsType GhcPs
-&gt; Maybe (GenLocated SrcSpan HsDocString) -&gt; LHsType GhcPs
</span><a href="GHC.Parser.PostProcess.Haddock.html#mkLHsDocTy"><span class="hs-identifier hs-var hs-var">mkLHsDocTy</span></a></span></span><span> </span><span id="local-6989586621680973327"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973327"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe (GenLocated SrcSpan HsDocString)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973327"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1447"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mkLHsDocTy"><span class="hs-identifier hs-var">mkLHsDocTy</span></a></span><span> </span><span id="local-6989586621680973326"><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973326"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680973325"><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
</span><a href="#local-6989586621680973325"><span class="hs-identifier hs-var">doc</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; HsType GhcPs -&gt; LHsType GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsType GhcPs -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973326"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XDocTy GhcPs
-&gt; LHsType GhcPs -&gt; GenLocated SrcSpan HsDocString -&gt; HsType GhcPs
forall pass.
XDocTy pass
-&gt; LHsType pass -&gt; GenLocated SrcSpan HsDocString -&gt; HsType pass
</span><a href="GHC.Hs.Type.html#HsDocTy"><span class="hs-identifier hs-var">HsDocTy</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XDocTy GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">LHsType GhcPs
</span><a href="#local-6989586621680973326"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan HsDocString
</span><a href="#local-6989586621680973325"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1448"></span><span>
</span><span id="line-1449"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#getForAllTeleLoc"><span class="hs-identifier hs-type">getForAllTeleLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Type.html#HsForAllTelescope"><span class="hs-identifier hs-type">HsForAllTelescope</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span>
</span><span id="line-1450"></span><span id="getForAllTeleLoc"><span class="annot"><span class="annottext">getForAllTeleLoc :: HsForAllTelescope GhcPs -&gt; SrcSpan
</span><a href="GHC.Parser.PostProcess.Haddock.html#getForAllTeleLoc"><span class="hs-identifier hs-var hs-var">getForAllTeleLoc</span></a></span></span><span> </span><span id="local-6989586621680973324"><span class="annot"><span class="annottext">HsForAllTelescope GhcPs
</span><a href="#local-6989586621680973324"><span class="hs-identifier hs-var">tele</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1451"></span><span>  </span><span class="annot"><span class="annottext">(SrcSpan -&gt; SrcSpan -&gt; SrcSpan) -&gt; SrcSpan -&gt; [SrcSpan] -&gt; SrcSpan
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#combineSrcSpans"><span class="hs-identifier hs-var">combineSrcSpans</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier hs-var">noSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">([SrcSpan] -&gt; SrcSpan) -&gt; [SrcSpan] -&gt; SrcSpan
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1452"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HsForAllTelescope GhcPs
</span><a href="#local-6989586621680973324"><span class="hs-identifier hs-var">tele</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1453"></span><span>    </span><span class="annot"><a href="GHC.Hs.Type.html#HsForAllVis"><span class="hs-identifier hs-type">HsForAllVis</span></a></span><span class="hs-special">{</span><span> </span><span id="local-6989586621680973320"><span class="annot"><span class="annottext">[LHsTyVarBndr () GhcPs]
hsf_vis_bndrs :: forall pass. HsForAllTelescope pass -&gt; [LHsTyVarBndr () pass]
hsf_vis_bndrs :: [LHsTyVarBndr () GhcPs]
</span><a href="GHC.Hs.Type.html#hsf_vis_bndrs"><span class="hs-identifier hs-var hs-var">hsf_vis_bndrs</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(LHsTyVarBndr () GhcPs -&gt; SrcSpan)
-&gt; [LHsTyVarBndr () GhcPs] -&gt; [SrcSpan]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LHsTyVarBndr () GhcPs -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsTyVarBndr () GhcPs]
</span><a href="#local-6989586621680973320"><span class="hs-identifier hs-var">hsf_vis_bndrs</span></a></span><span>
</span><span id="line-1454"></span><span>    </span><span class="annot"><a href="GHC.Hs.Type.html#HsForAllInvis"><span class="hs-identifier hs-type">HsForAllInvis</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680973317"><span class="annot"><span class="annottext">[LHsTyVarBndr Specificity GhcPs]
hsf_invis_bndrs :: forall pass.
HsForAllTelescope pass -&gt; [LHsTyVarBndr Specificity pass]
hsf_invis_bndrs :: [LHsTyVarBndr Specificity GhcPs]
</span><a href="GHC.Hs.Type.html#hsf_invis_bndrs"><span class="hs-identifier hs-var hs-var">hsf_invis_bndrs</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(LHsTyVarBndr Specificity GhcPs -&gt; SrcSpan)
-&gt; [LHsTyVarBndr Specificity GhcPs] -&gt; [SrcSpan]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LHsTyVarBndr Specificity GhcPs -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsTyVarBndr Specificity GhcPs]
</span><a href="#local-6989586621680973317"><span class="hs-identifier hs-var">hsf_invis_bndrs</span></a></span><span>
</span><span id="line-1455"></span><span>
</span><span id="line-1456"></span><span class="hs-comment">-- | The inverse of 'partitionBindsAndSigs' that merges partitioned items back</span><span>
</span><span id="line-1457"></span><span class="hs-comment">-- into a flat list. Elements are put back into the order in which they</span><span>
</span><span id="line-1458"></span><span class="hs-comment">-- appeared in the original program before partitioning, using BufPos to order</span><span>
</span><span id="line-1459"></span><span class="hs-comment">-- them.</span><span>
</span><span id="line-1460"></span><span class="hs-comment">--</span><span>
</span><span id="line-1461"></span><span class="hs-comment">-- Precondition (unchecked): the input lists are already sorted.</span><span>
</span><span id="line-1462"></span><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#flattenBindsAndSigs"><span class="hs-identifier hs-type">flattenBindsAndSigs</span></a></span><span>
</span><span id="line-1463"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LSig"><span class="hs-identifier hs-type">LSig</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LFamilyDecl"><span class="hs-identifier hs-type">LFamilyDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-1464"></span><span>      </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LTyFamInstDecl"><span class="hs-identifier hs-type">LTyFamInstDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LDataFamInstDecl"><span class="hs-identifier hs-type">LDataFamInstDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LDocDecl"><span class="hs-identifier hs-type">LDocDecl</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1465"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LHsDecl"><span class="hs-identifier hs-type">LHsDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1466"></span><span id="flattenBindsAndSigs"><span class="annot"><span class="annottext">flattenBindsAndSigs :: (LHsBinds GhcPs, [LSig GhcPs], [LFamilyDecl GhcPs],
 [LTyFamDefltDecl GhcPs], [LDataFamInstDecl GhcPs], [LDocDecl])
-&gt; [LHsDecl GhcPs]
</span><a href="GHC.Parser.PostProcess.Haddock.html#flattenBindsAndSigs"><span class="hs-identifier hs-var hs-var">flattenBindsAndSigs</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680973314"><span class="annot"><span class="annottext">LHsBinds GhcPs
</span><a href="#local-6989586621680973314"><span class="hs-identifier hs-var">all_bs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973313"><span class="annot"><span class="annottext">[LSig GhcPs]
</span><a href="#local-6989586621680973313"><span class="hs-identifier hs-var">all_ss</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973312"><span class="annot"><span class="annottext">[LFamilyDecl GhcPs]
</span><a href="#local-6989586621680973312"><span class="hs-identifier hs-var">all_ts</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973311"><span class="annot"><span class="annottext">[LTyFamDefltDecl GhcPs]
</span><a href="#local-6989586621680973311"><span class="hs-identifier hs-var">all_tfis</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973310"><span class="annot"><span class="annottext">[LDataFamInstDecl GhcPs]
</span><a href="#local-6989586621680973310"><span class="hs-identifier hs-var">all_dfis</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680973309"><span class="annot"><span class="annottext">[LDocDecl]
</span><a href="#local-6989586621680973309"><span class="hs-identifier hs-var">all_docs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1467"></span><span>  </span><span class="hs-comment">-- 'cmpBufSpan' is safe here with the following assumptions:</span><span>
</span><span id="line-1468"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-1469"></span><span>  </span><span class="hs-comment">-- * 'LHsDecl' produced by 'decl_cls' in Parser.y always have a 'BufSpan'</span><span>
</span><span id="line-1470"></span><span>  </span><span class="hs-comment">-- * 'partitionBindsAndSigs' does not discard this 'BufSpan'</span><span>
</span><span id="line-1471"></span><span>  </span><span class="annot"><span class="annottext">(LHsDecl GhcPs -&gt; LHsDecl GhcPs -&gt; Ordering)
-&gt; [[LHsDecl GhcPs]] -&gt; [LHsDecl GhcPs]
forall a. (a -&gt; a -&gt; Ordering) -&gt; [[a]] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#mergeListsBy"><span class="hs-identifier hs-var">mergeListsBy</span></a></span><span> </span><span class="annot"><span class="annottext">LHsDecl GhcPs -&gt; LHsDecl GhcPs -&gt; Ordering
forall a. HasDebugCallStack =&gt; Located a -&gt; Located a -&gt; Ordering
</span><a href="GHC.Types.SrcLoc.html#cmpBufSpan"><span class="hs-identifier hs-var">cmpBufSpan</span></a></span><span> </span><span class="hs-special">[</span><span>
</span><span id="line-1472"></span><span>    </span><span class="annot"><span class="annottext">(HsBind GhcPs -&gt; HsDecl GhcPs)
-&gt; [Located (HsBind GhcPs)] -&gt; [LHsDecl GhcPs]
forall a b. (a -&gt; b) -&gt; [Located a] -&gt; [Located b]
</span><a href="GHC.Parser.PostProcess.Haddock.html#mapLL"><span class="hs-identifier hs-var">mapLL</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680973306"><span class="annot"><span class="annottext">HsBind GhcPs
</span><a href="#local-6989586621680973306"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">XValD GhcPs -&gt; HsBind GhcPs -&gt; HsDecl GhcPs
forall p. XValD p -&gt; HsBind p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#ValD"><span class="hs-identifier hs-var">ValD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XValD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">HsBind GhcPs
</span><a href="#local-6989586621680973306"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBinds GhcPs -&gt; [Located (HsBind GhcPs)]
forall a. Bag a -&gt; [a]
</span><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier hs-var">bagToList</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBinds GhcPs
</span><a href="#local-6989586621680973314"><span class="hs-identifier hs-var">all_bs</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-1473"></span><span>    </span><span class="annot"><span class="annottext">(Sig GhcPs -&gt; HsDecl GhcPs) -&gt; [LSig GhcPs] -&gt; [LHsDecl GhcPs]
forall a b. (a -&gt; b) -&gt; [Located a] -&gt; [Located b]
</span><a href="GHC.Parser.PostProcess.Haddock.html#mapLL"><span class="hs-identifier hs-var">mapLL</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680973303"><span class="annot"><span class="annottext">Sig GhcPs
</span><a href="#local-6989586621680973303"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">XSigD GhcPs -&gt; Sig GhcPs -&gt; HsDecl GhcPs
forall p. XSigD p -&gt; Sig p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#SigD"><span class="hs-identifier hs-var">SigD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XSigD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">Sig GhcPs
</span><a href="#local-6989586621680973303"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LSig GhcPs]
</span><a href="#local-6989586621680973313"><span class="hs-identifier hs-var">all_ss</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1474"></span><span>    </span><span class="annot"><span class="annottext">(FamilyDecl GhcPs -&gt; HsDecl GhcPs)
-&gt; [LFamilyDecl GhcPs] -&gt; [LHsDecl GhcPs]
forall a b. (a -&gt; b) -&gt; [Located a] -&gt; [Located b]
</span><a href="GHC.Parser.PostProcess.Haddock.html#mapLL"><span class="hs-identifier hs-var">mapLL</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680973302"><span class="annot"><span class="annottext">FamilyDecl GhcPs
</span><a href="#local-6989586621680973302"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">XTyClD GhcPs -&gt; TyClDecl GhcPs -&gt; HsDecl GhcPs
forall p. XTyClD p -&gt; TyClDecl p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#TyClD"><span class="hs-identifier hs-var">TyClD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XTyClD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XFamDecl GhcPs -&gt; FamilyDecl GhcPs -&gt; TyClDecl GhcPs
forall pass. XFamDecl pass -&gt; FamilyDecl pass -&gt; TyClDecl pass
</span><a href="GHC.Hs.Decls.html#FamDecl"><span class="hs-identifier hs-var">FamDecl</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XFamDecl GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">FamilyDecl GhcPs
</span><a href="#local-6989586621680973302"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LFamilyDecl GhcPs]
</span><a href="#local-6989586621680973312"><span class="hs-identifier hs-var">all_ts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1475"></span><span>    </span><span class="annot"><span class="annottext">(TyFamInstDecl GhcPs -&gt; HsDecl GhcPs)
-&gt; [LTyFamDefltDecl GhcPs] -&gt; [LHsDecl GhcPs]
forall a b. (a -&gt; b) -&gt; [Located a] -&gt; [Located b]
</span><a href="GHC.Parser.PostProcess.Haddock.html#mapLL"><span class="hs-identifier hs-var">mapLL</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680973300"><span class="annot"><span class="annottext">TyFamInstDecl GhcPs
</span><a href="#local-6989586621680973300"><span class="hs-identifier hs-var">tfi</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">XInstD GhcPs -&gt; InstDecl GhcPs -&gt; HsDecl GhcPs
forall p. XInstD p -&gt; InstDecl p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#InstD"><span class="hs-identifier hs-var">InstD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XInstD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XTyFamInstD GhcPs -&gt; TyFamInstDecl GhcPs -&gt; InstDecl GhcPs
forall pass.
XTyFamInstD pass -&gt; TyFamInstDecl pass -&gt; InstDecl pass
</span><a href="GHC.Hs.Decls.html#TyFamInstD"><span class="hs-identifier hs-var">TyFamInstD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XTyFamInstD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">TyFamInstDecl GhcPs
</span><a href="#local-6989586621680973300"><span class="hs-identifier hs-var">tfi</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LTyFamDefltDecl GhcPs]
</span><a href="#local-6989586621680973311"><span class="hs-identifier hs-var">all_tfis</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1476"></span><span>    </span><span class="annot"><span class="annottext">(DataFamInstDecl GhcPs -&gt; HsDecl GhcPs)
-&gt; [LDataFamInstDecl GhcPs] -&gt; [LHsDecl GhcPs]
forall a b. (a -&gt; b) -&gt; [Located a] -&gt; [Located b]
</span><a href="GHC.Parser.PostProcess.Haddock.html#mapLL"><span class="hs-identifier hs-var">mapLL</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680973298"><span class="annot"><span class="annottext">DataFamInstDecl GhcPs
</span><a href="#local-6989586621680973298"><span class="hs-identifier hs-var">dfi</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">XInstD GhcPs -&gt; InstDecl GhcPs -&gt; HsDecl GhcPs
forall p. XInstD p -&gt; InstDecl p -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#InstD"><span class="hs-identifier hs-var">InstD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XInstD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XDataFamInstD GhcPs -&gt; DataFamInstDecl GhcPs -&gt; InstDecl GhcPs
forall pass.
XDataFamInstD pass -&gt; DataFamInstDecl pass -&gt; InstDecl pass
</span><a href="GHC.Hs.Decls.html#DataFamInstD"><span class="hs-identifier hs-var">DataFamInstD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XDataFamInstD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">DataFamInstDecl GhcPs
</span><a href="#local-6989586621680973298"><span class="hs-identifier hs-var">dfi</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LDataFamInstDecl GhcPs]
</span><a href="#local-6989586621680973310"><span class="hs-identifier hs-var">all_dfis</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1477"></span><span>    </span><span class="annot"><span class="annottext">(DocDecl -&gt; HsDecl GhcPs) -&gt; [LDocDecl] -&gt; [LHsDecl GhcPs]
forall a b. (a -&gt; b) -&gt; [Located a] -&gt; [Located b]
</span><a href="GHC.Parser.PostProcess.Haddock.html#mapLL"><span class="hs-identifier hs-var">mapLL</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680973297"><span class="annot"><span class="annottext">DocDecl
</span><a href="#local-6989586621680973297"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">XDocD GhcPs -&gt; DocDecl -&gt; HsDecl GhcPs
forall p. XDocD p -&gt; DocDecl -&gt; HsDecl p
</span><a href="GHC.Hs.Decls.html#DocD"><span class="hs-identifier hs-var">DocD</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XDocD GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">DocDecl
</span><a href="#local-6989586621680973297"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LDocDecl]
</span><a href="#local-6989586621680973309"><span class="hs-identifier hs-var">all_docs</span></a></span><span>
</span><span id="line-1478"></span><span>  </span><span class="hs-special">]</span><span>
</span><span id="line-1479"></span><span>
</span><span id="line-1480"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
*                   General purpose utilities                          *
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1485"></span><span>
</span><span id="line-1486"></span><span class="hs-comment">-- Cons an element to a list, if exists.</span><span>
</span><span id="line-1487"></span><span id="local-6989586621680974454"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mcons"><span class="hs-identifier hs-type">mcons</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974454"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680974454"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680974454"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1488"></span><span id="mcons"><span class="annot"><span class="annottext">mcons :: forall a. Maybe a -&gt; [a] -&gt; [a]
</span><a href="GHC.Parser.PostProcess.Haddock.html#mcons"><span class="hs-identifier hs-var hs-var">mcons</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; [a]) -&gt; (a -&gt; [a] -&gt; [a]) -&gt; Maybe a -&gt; [a] -&gt; [a]
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span class="hs-special">)</span><span>
</span><span id="line-1489"></span><span>
</span><span id="line-1490"></span><span class="hs-comment">-- Map a function over a list of located items.</span><span>
</span><span id="line-1491"></span><span id="local-6989586621680974334"><span id="local-6989586621680974335"><span class="annot"><a href="GHC.Parser.PostProcess.Haddock.html#mapLL"><span class="hs-identifier hs-type">mapLL</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680974335"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680974334"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974335"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680974334"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-1492"></span><span id="mapLL"><span class="annot"><span class="annottext">mapLL :: forall a b. (a -&gt; b) -&gt; [Located a] -&gt; [Located b]
</span><a href="GHC.Parser.PostProcess.Haddock.html#mapLL"><span class="hs-identifier hs-var hs-var">mapLL</span></a></span></span><span> </span><span id="local-6989586621680973295"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680973295"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan a -&gt; GenLocated SrcSpan b)
-&gt; [GenLocated SrcSpan a] -&gt; [GenLocated SrcSpan b]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; GenLocated SrcSpan a -&gt; GenLocated SrcSpan b
forall a b l. (a -&gt; b) -&gt; GenLocated l a -&gt; GenLocated l b
</span><a href="GHC.Types.SrcLoc.html#mapLoc"><span class="hs-identifier hs-var">mapLoc</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680973295"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1493"></span><span>
</span><span id="line-1494"></span><span class="hs-comment">{- Note [Old solution: Haddock in the grammar]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the past, Haddock comments were incorporated into the grammar (Parser.y).
This led to excessive complexity and duplication.

For example, here's the grammar production for types without documentation:

  type : btype
       | btype '-&gt;' ctype

To support Haddock, we had to also maintain an additional grammar production
for types with documentation on function arguments and function result:

  typedoc : btype
          | btype docprev
          | docnext btype
          | btype '-&gt;'     ctypedoc
          | btype docprev '-&gt;' ctypedoc
          | docnext btype '-&gt;' ctypedoc

Sometimes handling documentation comments during parsing led to bugs (#17561),
and sometimes it simply made it hard to modify and extend the grammar.

Another issue was that sometimes Haddock would fail to parse code
that GHC could parse succesfully:

  class BadIndent where
    f :: a -&gt; Int
  -- ^ comment
    g :: a -&gt; Int

This declaration was accepted by ghc but rejected by ghc -haddock.
-}</span><span>
</span><span id="line-1527"></span><span>
</span><span id="line-1528"></span><span class="hs-comment">{- Note [Register keyword location]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At the moment, 'addHaddock' erroneously associates some comments with
constructs that are separated by a keyword. For example:

    data Foo -- | Comment for MkFoo
      where MkFoo :: Foo

The issue stems from the lack of location information for keywords. We could
utilize API Annotations for this purpose, but not without modification. For
example, API Annotations operate on RealSrcSpan, whereas we need BufSpan.

Also, there's work towards making API Annotations available in-tree (not in
a separate Map), see #17638. This change should make the fix very easy (it
is not as easy with the current design).

See also testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.hs
-}</span><span>
</span><span id="line-1546"></span></pre></body></html>